diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95ffc74..c6baba6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,9 +137,35 @@ jobs: run: uv sync --dev - name: Run tests - run: uv run mypy pytest_sqlalchemy.py tests + run: uv run mypy src tests formatting: runs-on: ubuntu-latest steps: - uses: cjw296/python-action/check-formatting@v1 + + build-and-inspect-package: + needs: + - tests + - coverage + - typing + - formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: hynek/build-and-inspect-python-package@v2 + + check-package: + needs: + - build-and-inspect-package + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.9" + - "3.13" + steps: + - uses: cjw296/python-action/check-distributions@v1 + with: + package: pytest_sqlalchemy + python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b42ebba --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: "Release" + +on: + workflow_run: + workflows: [Continuous Integration] + types: [completed] + branches: [main] + +jobs: + check: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + outputs: + tag: ${{ steps.carthorse.outputs.tag }} + steps: + - uses: cjw296/python-action/carthorse@main + id: carthorse + with: + check: "true" + tag-format: '{version}' + + release: + runs-on: ubuntu-latest + needs: check + if: ${{ needs.check.outputs.tag != '' }} + permissions: + contents: write + id-token: write + steps: + - name: Show tag + run: echo "${{ toJson(needs.check.carthorse.outputs) }}" + shell: bash + + - name: Download packages from CI run + uses: dawidd6/action-download-artifact@v9 + with: + run_id: ${{ github.event.workflow_run.id }} + name: Packages + path: dist + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + - uses: cjw296/python-action/carthorse@main + with: + tag-format: '{version}' diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..66c1bea --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,21 @@ +Changes +------- + +0.2.1 (13.03.2018) +~~~~~~~~~~~~~~~~~~ + +* Fix behaviour under multiprocessing by recreating :class:`~sqlalchemy.engine.Engine` instance. + +0.2.0 (22.02.2018) +~~~~~~~~~~~~~~~~~~ +Feature release. Thanks to Sebastian Buczyński. + +* Added option to create the database on each run by using ``sqlalchemy-utils``. + +* Added option to run tests on multiple dynamically created databases + (``pytest-xdist``) like ``pytest-django`` does. + +0.1.1 (22.09.2017) +~~~~~~~~~~~~~~~~~~ + +Initial release. diff --git a/HISTORY.rst b/HISTORY.rst deleted file mode 100644 index 6c34a62..0000000 --- a/HISTORY.rst +++ /dev/null @@ -1,11 +0,0 @@ -0.2.0 (22.02.2018) -================== -Feature release. Thanks to Sebastian Buczyński. - -* Added option to create the database on each run by using sqlalchemy-utils. - -* Added option to run tests on multiple dynamically run databases - (pytest-xdist) like pytest-django does. - -0.1.1 -===== diff --git a/README.rst b/README.rst index 5450c9c..03792bd 100644 --- a/README.rst +++ b/README.rst @@ -75,7 +75,7 @@ Or override the ``sqlalchemy_connect_url`` fixture on your ``conftest.py`` file: return 'postgresql://scott:tiger@localhost:5432/mydatabase' Development ----------- +----------- To get going, in a checkout: diff --git a/docs/conf.py b/docs/conf.py index b5cba32..5ace6d5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -7,6 +7,7 @@ intersphinx_mapping = { 'python': ('http://docs.python.org', None), + 'sqlalchemy': ('https://docs.sqlalchemy.org/en/20', None), } project = 'pytest-sqlalchemy' diff --git a/docs/index.rst b/docs/index.rst index 72a3355..9f0a7f0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1 +1,3 @@ .. include:: ../README.rst + +.. include:: ../CHANGELOG.rst diff --git a/pyproject.toml b/pyproject.toml index d24c485..79ceee9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pytest-sqlalchemy" -version = "0.2.0" +version = "0.2.1" description = "pytest plugin with sqlalchemy related fixtures" authors = [ { name = "Torsten Irländer", email = "torsten.irlaender@googlemail.com" } @@ -40,13 +40,17 @@ docs = [ ] [build-system] -requires = ["setuptools>=61.0"] -build-backend = "setuptools.build_meta" +requires = ["hatchling"] +build-backend = "hatchling.build" [tool.coverage.run] source = ["pytest_sqlalchemy", "tests"] parallel = true +[tool.hatch.build.targets.sdist] +# paranoidly only include the package in the sdist: https://github.com/pypa/hatch/issues/304 +packages = ["src/pytest_sqlalchemy"] + [tool.mypy] disallow_untyped_defs = true disallow_incomplete_defs = true @@ -55,11 +59,11 @@ disallow_incomplete_defs = true module = "sqlalchemy_utils.*" ignore_missing_imports = true +[tool.pytest.ini_options] +norecursedirs = ["tests/examples"] + [tool.ruff] line-length = 100 [tool.ruff.format] quote-style = "preserve" - -[tool.pytest.ini_options] -norecursedirs = ["tests/examples"] diff --git a/pytest_sqlalchemy.py b/src/pytest_sqlalchemy/__init__.py similarity index 100% rename from pytest_sqlalchemy.py rename to src/pytest_sqlalchemy/__init__.py diff --git a/src/pytest_sqlalchemy/py.typed b/src/pytest_sqlalchemy/py.typed new file mode 100644 index 0000000..e69de29