diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..f13305c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,30 @@ +name: deploy + +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+" + +jobs: + deploy: + if: github.repository == 'pytest-dev/pytest-subtests' + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: "3.9" + - name: Install dependencies + run: | + python -m pip install --upgrade pip build + - name: Build package + run: | + python -m build + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_token }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9058c80..01c2c27 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,9 @@ name: build -on: [push, pull_request] +on: + push: + branches: + pull_request: jobs: build: @@ -80,29 +83,3 @@ jobs: - name: Test run: | tox -e ${{ matrix.tox_env }} - - deploy: - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - - runs-on: ubuntu-latest - - needs: [build] - - steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: "3.7" - - name: Install wheel - run: | - python -m pip install --upgrade pip - python -m pip install --upgrade wheel setuptools - - name: Build package - run: | - python setup.py sdist bdist_wheel - - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_token }} diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c290a01..8598d5a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ CHANGELOG ========= +0.7.0 (2022-02-13) +------------------ + +* Fixed support for pytest 7.0, and ``pytest>=7.0`` is now required. + + 0.6.0 (2022-01-15) ------------------ diff --git a/pytest_subtests.py b/pytest_subtests.py index 72d1906..97158fd 100644 --- a/pytest_subtests.py +++ b/pytest_subtests.py @@ -79,7 +79,11 @@ def _addSubTest(self, test_case, test, exc_info): if exc_info is not None: msg = test._message if isinstance(test._message, str) else None call_info = make_call_info( - ExceptionInfo(exc_info), start=0, stop=0, duration=0, when="call" + ExceptionInfo(exc_info, _ispytest=True), + start=0, + stop=0, + duration=0, + when="call", ) report = self.ihook.pytest_runtest_makereport(item=self, call=call_info) sub_report = SubTestReport._from_test_report(report) @@ -189,13 +193,15 @@ def test(self, msg=None, **kwargs): def make_call_info(exc_info, *, start, stop, duration, when): - try: - return CallInfo( - None, exc_info, start=start, stop=stop, duration=duration, when=when - ) - except TypeError: - # support for pytest<6: didn't have a duration parameter then - return CallInfo(None, exc_info, start=start, stop=stop, when=when) + return CallInfo( + None, + exc_info, + start=start, + stop=stop, + duration=duration, + when=when, + _ispytest=True, + ) @contextmanager diff --git a/setup.py b/setup.py index 5a8dc20..b681143 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,11 @@ -import codecs -import os +from pathlib import Path from setuptools import setup -def read(fname): - file_path = os.path.join(os.path.dirname(__file__), fname) - return codecs.open(file_path, encoding="utf-8").read() - +long_description = ( + Path(__file__).parent.joinpath("README.rst").read_text(encoding="UTF-8") +) setup( name="pytest-subtests", @@ -18,12 +16,12 @@ def read(fname): license="MIT", url="https://github.com/pytest-dev/pytest-subtests", description="unittest subTest() support and subtests fixture", - long_description=read("README.rst"), + long_description=long_description, py_modules=["pytest_subtests"], use_scm_version=True, setup_requires=["setuptools-scm", "setuptools>=40.0"], python_requires=">=3.6", - install_requires=["pytest>=6.0"], + install_requires=["pytest>=7.0"], classifiers=[ "Development Status :: 4 - Beta", "Framework :: Pytest",