Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: deploy

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
default: '1.2.3'

jobs:

package:
runs-on: ubuntu-latest
# Required by attest-build-provenance-github.
permissions:
id-token: write
attestations: write
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}

steps:
- uses: actions/checkout@v4

- name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v2.13.0
with:
attest-build-provenance-github: 'true'


deploy:
needs: package
runs-on: ubuntu-latest
environment: PyPI
permissions:
id-token: write # For PyPI trusted publishers.
contents: write # For tag and release notes.

steps:
- uses: actions/checkout@v4

- name: Download Package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.4
with:
attestations: true

- name: Push tag
run: |
git config user.name "pytest bot"
git config user.email "pytestbot@gmail.com"
git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }}
git push origin v${{ github.event.inputs.version }}

- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*
tag_name: v${{ github.event.inputs.version }}
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: test

on:
push:
branches:
- main
- "test-me-*"

pull_request:


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

package:

runs-on: ubuntu-latest

permissions:
id-token: write
attestations: write

steps:
- uses: actions/checkout@v4
- name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v2.13.0

test:
needs: [package]

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4

- name: Download Package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true

- name: System dependencies
run: |
sudo apt-get update
sudo apt-get install xvfb python3-dev libmemcached-dev libmysqlclient-dev memcached libmemcached-tools

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox

- name: Test
shell: bash
run: |
tox run -e py --installpkg `find dist/*.tar.gz`
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions DEPENDENCIES

This file was deleted.

4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

27 changes: 0 additions & 27 deletions Makefile

This file was deleted.

12 changes: 12 additions & 0 deletions RELEASING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Here are the steps on how to make a new release.

1. Create a ``release-VERSION`` branch from ``upstream/main``.
2. Update ``CHANGELOG.rst``.
3. Push the branch to ``upstream``.
4. Once all tests pass, start the ``deploy`` workflow manually or via:

```
gh workflow run deploy.yml --repo pytest-dev/pytest-services --ref release-VERSION -f version=VERSION
```

5. Merge the PR.
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4.1"]
requires = ["setuptools>=61", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
27 changes: 17 additions & 10 deletions pytest_services/mysql.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Fixtures for mysql."""
import os
import shutil
from textwrap import dedent

from distutils.spawn import find_executable # pylint: disable=E0611
import pytest

from .process import (
Expand All @@ -16,22 +16,28 @@ def mysql_defaults_file(
run_services, tmp_path_factory, memory_temp_dir, request):
"""MySQL defaults file."""
if run_services:
cfg = tmp_path_factory.mktemp(request.session.name)
cfg = tmp_path_factory.mktemp("pytest-services")
defaults_path = str(cfg / 'defaults.cnf')

with open(defaults_path, 'w+') as fd:
fd.write("""
[mysqld]
user = {user}
tmpdir = {tmpdir}
default-time-zone = SYSTEM
""".format(user=os.environ['USER'], tmpdir=memory_temp_dir))
user = os.environ["USER"]
fd.write(
dedent(
f"""
[mysqld]
user = {user}
tmpdir = {memory_temp_dir}
default-time-zone = SYSTEM
"""
)
)
return defaults_path
return None


@pytest.fixture(scope='session')
def mysql_base_dir():
my_print_defaults = find_executable('my_print_defaults')
my_print_defaults = shutil.which('my_print_defaults')
assert my_print_defaults, 'You have to install my_print_defaults script.'

return os.path.dirname(os.path.dirname(os.path.realpath(my_print_defaults)))
Expand All @@ -49,7 +55,8 @@ def mysql_system_database(
):
"""Install database to given path."""
if run_services:
mysqld = find_executable('mysqld')
pytest.skip(reason="#50 needs investigation")
mysqld = shutil.which('mysqld')
assert mysqld, 'You have to install mysqld script.'

try:
Expand Down
3 changes: 0 additions & 3 deletions requirements-testing.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# apt-get install xvfb python-dev libmemcached-dev libmysqlclient-dev
coverage
mysqlclient
pylibmc
pytest-pep8
astroid
6 changes: 0 additions & 6 deletions setup.cfg

This file was deleted.

38 changes: 16 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
"""Setuptools entry point."""
import codecs
import os
import sys
import re

from setuptools import setup
from pathlib import Path

dirname = os.path.dirname(__file__)
dirname = Path(__file__).parent

long_description = (
codecs.open(os.path.join(dirname, 'README.rst'), encoding='utf-8').read() + '\n' +
codecs.open(os.path.join(dirname, 'AUTHORS.rst'), encoding='utf-8').read() + '\n' +
codecs.open(os.path.join(dirname, 'CHANGES.rst'), encoding='utf-8').read()
dirname.joinpath('README.rst').read_text(encoding="UTF-8") + '\n' +
dirname.joinpath('AUTHORS.rst').read_text(encoding="UTF-8") + '\n' +
dirname.joinpath('CHANGES.rst').read_text(encoding="UTF-8")
)

install_requires = [
Expand All @@ -21,32 +17,24 @@
'zc.lockfile >= 2.0',
]

PY2 = sys.version_info[0] < 3

if PY2:
install_requires.append('subprocess32')

with codecs.open(os.path.join(dirname, "pytest_services", "__init__.py"), encoding="utf-8") as fd:
VERSION = re.compile(r".*__version__ = ['\"](.*?)['\"]", re.S).match(fd.read()).group(1)


setup(
name='pytest-services',
description='Services plugin for pytest testing framework',
long_description=long_description,
long_description_content_type="text/x-rst",
author='Anatoly Bubenkov, Paylogic International and others',
license='MIT license',
license='MIT',
author_email='bubenkoff@gmail.com',
version=VERSION,
url='https://github.com/pytest-dev/pytest-services',
install_requires=install_requires,
extras={
'memcached': ['pylibmc'],
},
python_requires=">=3.9",
install_requires=install_requires,
classifiers=[
'Development Status :: 6 - Mature',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
Expand All @@ -55,7 +43,13 @@
'Topic :: Utilities',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
] + [('Programming Language :: Python :: %s' % x) for x in '2.7 3.4 3.5 3.6 3.7'.split()],
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
],
tests_require=['tox'],
entry_points={'pytest11': [
'pytest-services=pytest_services.plugin',
Expand Down
Loading