Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pytest-check-links for openSUSE:Factory checked in at 2023-07-25 11:51:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-check-links (Old) and /work/SRC/openSUSE:Factory/.python-pytest-check-links.new.1467 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-check-links" Tue Jul 25 11:51:22 2023 rev:8 rq:1100441 version:0.9.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-check-links/python-pytest-check-links.changes 2023-05-05 17:13:03.451302118 +0200 +++ /work/SRC/openSUSE:Factory/.python-pytest-check-links.new.1467/python-pytest-check-links.changes 2023-07-25 11:53:08.122166380 +0200 @@ -1,0 +2,10 @@ +Mon Jul 24 18:50:23 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.9.0: + * Support Python 3.8-3.12 and Handle Flaky Tests #110 + * Update ruff #106 + * Use local coverage #105 + * Switch to pytester in tests + * Add more linting #100 + +------------------------------------------------------------------- Old: ---- pytest_check_links-0.8.0.tar.gz New: ---- pytest_check_links-0.9.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-check-links.spec ++++++ --- /var/tmp/diff_new_pack.veDA1g/_old 2023-07-25 11:53:08.702169776 +0200 +++ /var/tmp/diff_new_pack.veDA1g/_new 2023-07-25 11:53:08.706169800 +0200 @@ -20,7 +20,7 @@ %bcond_with test %{?sle15_python_module_pythons} Name: python-pytest-check-links -Version: 0.8.0 +Version: 0.9.0 Release: 0 Summary: Pytest plugin for checking links in files License: BSD-3-Clause ++++++ pytest_check_links-0.8.0.tar.gz -> pytest_check_links-0.9.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/.github/workflows/tests.yml new/pytest_check_links-0.9.0/.github/workflows/tests.yml --- old/pytest_check_links-0.8.0/.github/workflows/tests.yml 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/.github/workflows/tests.yml 2020-02-02 01:00:00.000000000 +0100 @@ -18,27 +18,39 @@ fail-fast: false matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] - python-version: ["3.7", "3.11"] + python-version: ["3.8", "3.11"] include: - os: windows-latest python-version: "3.9" - os: ubuntu-latest python-version: "pypy-3.8" - os: ubuntu-latest - python-version: "3.11" + python-version: "3.12" - os: macos-latest - python-version: "3.8" + python-version: "3.10" steps: - uses: actions/checkout@v3 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - name: Run the tests on pypy + if: ${{ startsWith(matrix.python-version, 'pypy') }} + run: | + hatch run cov:nowarn -s || hatch run test:nowarn -s --lf - name: Run the tests + if: ${{ !startsWith(matrix.python-version, 'pypy') }} timeout-minutes: 15 run: | hatch run cov:test -s || hatch run test:test -s --lf - - name: Upload coverage - run: | - pip install codecov - codecov + - uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1 + + coverage: + runs-on: ubuntu-latest + needs: + - build + steps: + - uses: actions/checkout@v3 + - uses: jupyterlab/maintainer-tools/.github/actions/report-coverage@v1 + with: + fail_under: 75 test_lint: name: Test Lint @@ -61,7 +73,7 @@ - uses: actions/checkout@v3 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 with: - python_version: "3.7" + python_version: "3.8" - uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1 with: only_create_file: 1 @@ -131,7 +143,7 @@ tests_check: # This job does nothing and is only used for the branch protection if: always() needs: - - build + - coverage - test_lint - test_minimum_versions - test_prereleases diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/.pre-commit-config.yaml new/pytest_check_links-0.9.0/.pre-commit-config.yaml --- old/pytest_check_links-0.8.0/.pre-commit-config.yaml 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/.pre-commit-config.yaml 2020-02-02 01:00:00.000000000 +0100 @@ -19,7 +19,7 @@ - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.19.2 + rev: 0.22.0 hooks: - id: check-github-workflows @@ -31,12 +31,12 @@ [mdformat-gfm, mdformat-frontmatter, mdformat-footnote] - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.189 + rev: v0.0.263 hooks: - id: ruff args: ["--fix"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/CHANGELOG.md new/pytest_check_links-0.9.0/CHANGELOG.md --- old/pytest_check_links-0.8.0/CHANGELOG.md 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/CHANGELOG.md 2020-02-02 01:00:00.000000000 +0100 @@ -2,6 +2,26 @@ <!-- <START NEW CHANGELOG ENTRY> --> +## 0.9.0 + +([Full Changelog](https://github.com/jupyterlab/pytest-check-links/compare/v0.8.0...8c58f8f8c42c247256f03a99504165ba7646e0e0)) + +### Maintenance and upkeep improvements + +- Support Python 3.8-3.12 and Handle Flaky Tests [#110](https://github.com/jupyterlab/pytest-check-links/pull/110) ([@blink1073](https://github.com/blink1073)) +- Update ruff [#106](https://github.com/jupyterlab/pytest-check-links/pull/106) ([@blink1073](https://github.com/blink1073)) +- Use local coverage [#105](https://github.com/jupyterlab/pytest-check-links/pull/105) ([@blink1073](https://github.com/blink1073)) +- Switch to pytester in tests [#103](https://github.com/jupyterlab/pytest-check-links/pull/103) ([@blink1073](https://github.com/blink1073)) +- Add more linting [#100](https://github.com/jupyterlab/pytest-check-links/pull/100) ([@blink1073](https://github.com/blink1073)) + +### Contributors to this release + +([GitHub contributors page for this release](https://github.com/jupyterlab/pytest-check-links/graphs/contributors?from=2022-12-26&to=2023-06-19&type=c)) + +[@blink1073](https://github.com/search?q=repo%3Ajupyterlab%2Fpytest-check-links+involves%3Ablink1073+updated%3A2022-12-26..2023-06-19&type=Issues) | [@codecov](https://github.com/search?q=repo%3Ajupyterlab%2Fpytest-check-links+involves%3Acodecov+updated%3A2022-12-26..2023-06-19&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyterlab%2Fpytest-check-links+involves%3Apre-commit-ci+updated%3A2022-12-26..2023-06-19&type=Issues) + +<!-- <END NEW CHANGELOG ENTRY> --> + ## 0.8.0 ([Full Changelog](https://github.com/jupyterlab/pytest-check-links/compare/v0.7.1...dafddb42b22f480303a76bb46a7042e360c2379a)) @@ -18,8 +38,6 @@ [@blink1073](https://github.com/search?q=repo%3Ajupyterlab%2Fpytest-check-links+involves%3Ablink1073+updated%3A2022-04-07..2022-12-26&type=Issues) | [@bollwyvl](https://github.com/search?q=repo%3Ajupyterlab%2Fpytest-check-links+involves%3Abollwyvl+updated%3A2022-04-07..2022-12-26&type=Issues) | [@codecov](https://github.com/search?q=repo%3Ajupyterlab%2Fpytest-check-links+involves%3Acodecov+updated%3A2022-04-07..2022-12-26&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyterlab%2Fpytest-check-links+involves%3Awelcome+updated%3A2022-04-07..2022-12-26&type=Issues) -<!-- <END NEW CHANGELOG ENTRY> --> - ## 0.7.1 ([Full Changelog](https://github.com/jupyterlab/pytest-check-links/compare/v0.7.0...17cf01b96afe0f933b476fd2882009db440e805d)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/PKG-INFO new/pytest_check_links-0.9.0/PKG-INFO --- old/pytest_check_links-0.8.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pytest_check_links -Version: 0.8.0 +Version: 0.9.0 Summary: Check links in files Project-URL: Homepage, https://github.com/jupyterlab/pytest-check-links Author-email: Jupyter Development Team <jupy...@googlegroups.com> @@ -43,15 +43,11 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Documentation Classifier: Topic :: Documentation :: Sphinx Classifier: Topic :: Software Development :: Quality Assurance Classifier: Topic :: Software Development :: Testing -Requires-Python: >=3.7 +Requires-Python: >=3.8 Requires-Dist: docutils Requires-Dist: html5lib Requires-Dist: nbconvert @@ -61,7 +57,7 @@ Provides-Extra: cache Requires-Dist: requests-cache>=0.9.7; extra == 'cache' Provides-Extra: test -Requires-Dist: mistune<1; python_version < '3.10' and extra == 'test' +Requires-Dist: flaky; extra == 'test' Requires-Dist: pre-commit; extra == 'test' Requires-Dist: requests-cache>=0.9.7; extra == 'test' Description-Content-Type: text/markdown @@ -70,7 +66,6 @@ pytest plugin that checks URLs for HTML-containing files. -[](https://codecov.io/gh/jupyterlab/pytest-check-links) [](https://github.com/jupyterlab/pytest-check-links/actions?query=workflow%3ATests+branch%3Amaster) [](https://badge.fury.io/py/pytest-check-links)  diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/README.md new/pytest_check_links-0.9.0/README.md --- old/pytest_check_links-0.8.0/README.md 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/README.md 2020-02-02 01:00:00.000000000 +0100 @@ -2,7 +2,6 @@ pytest plugin that checks URLs for HTML-containing files. -[](https://codecov.io/gh/jupyterlab/pytest-check-links) [](https://github.com/jupyterlab/pytest-check-links/actions?query=workflow%3ATests+branch%3Amaster) [](https://badge.fury.io/py/pytest-check-links)  diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/codecov.yml new/pytest_check_links-0.9.0/codecov.yml --- old/pytest_check_links-0.8.0/codecov.yml 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/codecov.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -coverage: - status: - project: - default: - target: auto - threshold: 1 - patch: - default: - target: 0% diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/pyproject.toml new/pytest_check_links-0.9.0/pyproject.toml --- old/pytest_check_links-0.8.0/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 @@ -15,17 +15,13 @@ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Topic :: Documentation", "Topic :: Documentation :: Sphinx", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing", ] keywords = ["testing", "documentation", "links", "html"] -requires-python = ">=3.7" +requires-python = ">=3.8" dependencies = [ "docutils", "html5lib", @@ -48,7 +44,7 @@ [project.optional-dependencies] cache = ["requests-cache>=0.9.7"] -test = ["requests-cache>=0.9.7", "pre-commit", "mistune<1;python_version<\"3.10\""] +test = ["requests-cache>=0.9.7", "pre-commit", "flaky"] [project.scripts] pytest-check-links = "pytest_check_links.__main__:main" @@ -67,14 +63,14 @@ [tool.hatch.envs.test] features = ["test"] [tool.hatch.envs.test.scripts] -test = "python -m pytest -vv {args}" +test = "pytest -vv {args}" nowarn = "test -W default {args}" [tool.hatch.envs.cov] features = ["test"] -dependencies = ["coverage", "pytest-cov"] +dependencies = ["coverage[toml]"] [tool.hatch.envs.cov.scripts] -test = "python -m pytest -vv --cov pytest_check_links --cov-branch --cov-report term-missing:skip-covered {args}" +test = "coverage run -m pytest {args}" nowarn = "test -W default {args}" [tool.hatch.envs.typing] @@ -84,7 +80,7 @@ test = "mypy --install-types --non-interactive {args:.}" [tool.hatch.envs.lint] -dependencies = ["black[jupyter]==22.10.0", "mdformat>0.7", "ruff==0.0.189"] +dependencies = ["black[jupyter]==23.1.0", "mdformat>0.7", "ruff==0.0.263"] detached = true [tool.hatch.envs.lint.scripts] style = [ @@ -119,6 +115,10 @@ "@(abc\\.)?abstractmethod", ] +[tool.coverage.run] +relative_files = true +source = ["pytest_check_links"] + [tool.mypy] check_untyped_defs = true disallow_subclassing_any = true @@ -141,38 +141,19 @@ target-version = "py38" line-length = 100 select = [ - "A", "B", "C", "E", "F", "FBT", "I", "N", "Q", "RUF", "S", "T", - "UP", "W", "YTT", + "A", "B", "C", "DTZ", "E", "EM", "F", "FBT", "I", "ICN", "ISC", "N", + "PLC", "PLE", "PLR", "PLW", "Q", "RUF", "S", "SIM", "T", "TID", "UP", + "W", "YTT", ] ignore = [ - # Allow non-abstract empty methods in abstract base classes - "B027", - # Ignore McCabe complexity - "C901", - # Allow boolean positional values in function calls, like `dict.get(... True)` - "FBT003", - # Use of `assert` detected - "S101", - # Line too long - "E501", - # Relative imports are banned - "TID252", - # Boolean ... in function definition - "FBT001", - "FBT002", - # Module level import not at top of file - "E402", - # A001/A002/A003 .. is shadowing a python builtin - "A001", - "A002", - "A003", - # Possible hardcoded password - "S105", - "S106", - # Q000 Single quotes found but double quotes preferred - "Q000", - # N806 Variable `B` in function should be lowercase - "N806", +# Q000 Single quotes found but double quotes preferred +"Q000", +# FBT001 Boolean positional arg in function definition +"FBT001", "FBT002", "FBT003", +# E501 Line too long (158 > 100 characters) +"E501", +# SIM105 Use `contextlib.suppress(...)` +"SIM105", ] unfixable = [ # Don't touch print statements @@ -189,7 +170,8 @@ # T201 `print` found # B007 Loop control variable `i` not used within the loop body. # N802 Function name `assertIn` should be lowercase -"tests/*" = ["B011", "F841", "C408", "E402", "T201", "B007", "N802"] +# S101 Use of `assert` detected +"test/*" = ["B011", "F841", "C408", "E402", "T201", "B007", "N802", "S101"] [tool.interrogate] ignore-init-module=true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/pytest_check_links/__main__.py new/pytest_check_links-0.9.0/pytest_check_links/__main__.py --- old/pytest_check_links-0.8.0/pytest_check_links/__main__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/pytest_check_links/__main__.py 2020-02-02 01:00:00.000000000 +0100 @@ -18,7 +18,7 @@ args = sys.argv[1:] return subprocess.call( - [sys.executable, "-m", "pytest", "--check-links", "-p", "no:python"] + args + [sys.executable, "-m", "pytest", "--check-links", "-p", "no:python", *args] # noqa ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/pytest_check_links/_version.py new/pytest_check_links-0.9.0/pytest_check_links/_version.py --- old/pytest_check_links-0.8.0/pytest_check_links/_version.py 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/pytest_check_links/_version.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,2 +1,2 @@ """Version info.""" -__version__ = "0.8.0" +__version__ = "0.9.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/pytest_check_links/args.py new/pytest_check_links-0.9.0/pytest_check_links/args.py --- old/pytest_check_links-0.8.0/pytest_check_links/args.py 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/pytest_check_links/args.py 2020-02-02 01:00:00.000000000 +0100 @@ -9,7 +9,8 @@ def __init__(self, option_strings, dest, nargs=None, **kwargs): """Initialize the action.""" if nargs is not None: - raise ValueError("nargs not allowed") + msg = "nargs not allowed" + raise ValueError(msg) super().__init__(option_strings, dest, **kwargs) def __call__(self, parser, namespace, values, option_string=None): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/pytest_check_links/plugin.py new/pytest_check_links-0.9.0/pytest_check_links/plugin.py --- old/pytest_check_links-0.8.0/pytest_check_links/plugin.py 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/pytest_check_links/plugin.py 2020-02-02 01:00:00.000000000 +0100 @@ -267,7 +267,9 @@ parent: CheckLinks - def __init__(self, name=None, parent=None, target=None, parsed=None, description="", **kwargs): + def __init__( # noqa + self, name=None, parent=None, target=None, parsed=None, description="", **kwargs + ): """Initialize the item.""" super().__init__(name, parent, **kwargs) self.target = target @@ -339,7 +341,7 @@ raise BrokenLinkError(url, "%s" % err) from err - if response.status_code >= 400: + if response.status_code >= 400: # noqa if retries and self.sleep(response.headers): self.uncache_url(url_no_anchor) return self.fetch_with_retries(url, retries=retries - 1) @@ -355,11 +357,13 @@ uncached = False session = self.parent.requests_session if session is None: - raise ValueError('No current session') + msg = 'No current session' + raise ValueError(msg) if hasattr(session, "cache"): request = Request("GET", url, headers=session.headers).prepare() if session.cache is None: - raise ValueError("No session cache found") + msg = "No session cache found" + raise ValueError(msg) cache: BaseCache = session.cache key = cache.create_key(request) if cache.contains(key): @@ -367,7 +371,7 @@ uncached = True return uncached - def runtest(self): + def runtest(self): # noqa """Run the test.""" url = self.target or "" @@ -426,4 +430,6 @@ """Validate the extensions.""" invalid = set(extensions) - supported_extensions if invalid: - warnings.warn("Unsupported extensions for check-links: %s" % extensions_str(invalid)) + warnings.warn( + "Unsupported extensions for check-links: %s" % extensions_str(invalid), stacklevel=2 + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/test/conftest.py new/pytest_check_links-0.9.0/test/conftest.py --- old/pytest_check_links-0.8.0/test/conftest.py 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/test/conftest.py 2020-02-02 01:00:00.000000000 +0100 @@ -19,4 +19,4 @@ @pytest.fixture def memory_args(base_args): - return base_args + ["--check-links-cache-backend", "memory"] + return [*base_args, "--check-links-cache-backend", "memory"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/test/test_anchors.py new/pytest_check_links-0.9.0/test/test_anchors.py --- old/pytest_check_links-0.8.0/test/test_anchors.py 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/test/test_anchors.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,18 +1,18 @@ -def test_anchors_local_self(testdir, anchor_args): - testdir.copy_example("anchors_self.html") - result = testdir.runpytest(*anchor_args) +def test_anchors_local_self(pytester, anchor_args): + pytester.copy_example("anchors_self.html") + result = pytester.runpytest(*anchor_args) result.assert_outcomes(passed=2, failed=2) -def test_anchors_local_other(testdir, anchor_args): - testdir.copy_example("anchors_self.html") - testdir.copy_example("anchors_other.html") - args = anchor_args + ["anchors_other.html"] - result = testdir.runpytest(*args) +def test_anchors_local_other(pytester, anchor_args): + pytester.copy_example("anchors_self.html") + pytester.copy_example("anchors_other.html") + args = [*anchor_args, "anchors_other.html"] + result = pytester.runpytest(*args) result.assert_outcomes(passed=1, failed=2) -def test_anchors_external(testdir, anchor_args): - testdir.copy_example("anchors_remote.html") - result = testdir.runpytest(*anchor_args) +def test_anchors_external(pytester, anchor_args): + pytester.copy_example("anchors_remote.html") + result = pytester.runpytest(*anchor_args) result.assert_outcomes(passed=1, failed=1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/test/test_cache.py new/pytest_check_links-0.9.0/test/test_cache.py --- old/pytest_check_links-0.8.0/test/test_cache.py 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/test/test_cache.py 2020-02-02 01:00:00.000000000 +0100 @@ -6,11 +6,12 @@ import pytest import requests_cache +from flaky import flaky # type:ignore -def assert_sqlite(testdir, name=None, tmpdir=None, exists=True): +def assert_sqlite(pytester, name=None, tmpdir=None, exists=True): name = name or ".pytest-check-links-cache.sqlite" - tmpdir = str(tmpdir or testdir.tmpdir) + tmpdir = str(tmpdir or pytester.path) caches = list(glob(os.path.join(tmpdir, name))) if exists: assert caches @@ -18,28 +19,29 @@ assert not caches +@flaky @pytest.mark.skipif(sys.implementation.name.lower() == "pypy", reason="Does not work on pypy") @pytest.mark.parametrize("cache_name", [None, "custom-cache"]) -def test_cache_expiry(testdir, base_args, cache_name, tmpdir): +def test_cache_expiry(pytester, base_args, cache_name, tmpdir): """will the default sqlite3 backend persist and then expire?""" - testdir.copy_example("linkcheck.ipynb") + pytester.copy_example("linkcheck.ipynb") - args = base_args + ["--check-links-cache-expire-after", "2"] + args = [*base_args, "--check-links-cache-expire-after", "2"] if cache_name: args += ["--check-links-cache-name", os.path.join(str(tmpdir), cache_name)] expected = {"passed": 3, "failed": 4} t0 = time.time() - result = testdir.runpytest(*args) + result = pytester.runpytest_subprocess(*args) t1 = time.time() result.assert_outcomes(**expected) if cache_name: - assert_sqlite(testdir, name=f"{cache_name}.sqlite", tmpdir=tmpdir) + assert_sqlite(pytester, name=f"{cache_name}.sqlite", tmpdir=tmpdir) else: - assert_sqlite(testdir) + assert_sqlite(pytester) t2 = time.time() - result = testdir.runpytest(*args) + result = pytester.runpytest_subprocess(*args) t3 = time.time() result.assert_outcomes(**expected) @@ -51,7 +53,7 @@ time.sleep(2) t4 = time.time() - result = testdir.runpytest(*args) + result = pytester.runpytest_subprocess(*args) t5 = time.time() result.assert_outcomes(**expected) @@ -61,26 +63,27 @@ assert d2 > d3, "cache did not expire" -def test_cache_memory(testdir, memory_args): +@flaky +def test_cache_memory(pytester, memory_args): """will the memory backend cache links inside a run?""" - expected = dict(passed=3, failed=0) # noqa + expected = dict(passed=3, failed=0) - testdir.copy_example("httpbin.md") + pytester.copy_example("httpbin.md") def run(passed): t0 = time.time() - result = testdir.runpytest(*memory_args) + result = pytester.runpytest_subprocess(*memory_args) t1 = time.time() result.assert_outcomes(passed=passed, failed=0) - assert_sqlite(testdir, exists=False) + assert_sqlite(pytester, exists=False) return t1 - t0 d0 = run(6) for i in range(5): shutil.copy( - os.path.join(str(testdir.tmpdir), "httpbin.md"), - os.path.join(str(testdir.tmpdir), f"httpbin{i}.md"), + os.path.join(str(pytester.path), "httpbin.md"), + os.path.join(str(pytester.path), f"httpbin{i}.md"), ) d1 = run(36) @@ -88,10 +91,11 @@ assert d1 < d0 * 4 -def test_cache_retry(testdir, memory_args): +@flaky +def test_cache_retry(pytester, memory_args): """will a Retry-After header work with cache?""" - testdir.copy_example("httpbin.md") + pytester.copy_example("httpbin.md") attempts: list = [] @@ -99,7 +103,7 @@ def mock_get(*args, **kwargs): response = _get(*args, **kwargs) - if len(attempts) < 5: + if len(attempts) < 5: # noqa response.status_code = 502 response.headers["Retry-After"] = "0" attempts.append([args, kwargs]) @@ -107,23 +111,25 @@ requests_cache.CachedSession.get = mock_get # type:ignore - result = testdir.runpytest(*memory_args) + result = pytester.runpytest_inprocess(*memory_args) try: result.assert_outcomes(passed=5, failed=1) - assert len(attempts) == 10 + assert len(attempts) == 10 # noqa finally: requests_cache.CachedSession.get = _get # type:ignore -def test_cache_backend_opts(testdir, base_args): - testdir.copy_example("httpbin.md") - args = base_args + [ +@flaky +def test_cache_backend_opts(pytester, base_args): + pytester.copy_example("httpbin.md") + args = [ + *base_args, "--check-links-cache-backend-opt", "fast_save:true", "--check-links-cache-name", "foo", ] - result = testdir.runpytest(*args) + result = pytester.runpytest_subprocess(*args) result.assert_outcomes(passed=6, failed=0) - assert_sqlite(testdir, name="foo.sqlite") + assert_sqlite(pytester, name="foo.sqlite") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/test/test_check_links.py new/pytest_check_links-0.9.0/test/test_check_links.py --- old/pytest_check_links-0.8.0/test/test_check_links.py 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/test/test_check_links.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,61 +1,63 @@ +import shutil + from .conftest import skip_pywin32 -def test_ipynb(testdir): - testdir.copy_example("linkcheck.ipynb") - result = testdir.runpytest("-v", "--check-links") +def test_ipynb(pytester): + pytester.copy_example("linkcheck.ipynb") + result = pytester.runpytest_subprocess("-v", "--check-links") result.assert_outcomes(passed=3, failed=4) - result = testdir.runpytest( + result = pytester.runpytest_subprocess( "-v", "--check-links", "--check-links-ignore", "http.*example.com/.*" ) result.assert_outcomes(passed=3, failed=3) -def test_markdown(testdir): - testdir.copy_example("markdown.md") - result = testdir.runpytest("-v", "--check-links") +def test_markdown(pytester): + pytester.copy_example("markdown.md") + result = pytester.runpytest_subprocess("-v", "--check-links") result.assert_outcomes(passed=7, failed=3) - result = testdir.runpytest( + result = pytester.runpytest_subprocess( "-v", "--check-links", "--check-links-ignore", "http.*example.com/.*" ) result.assert_outcomes(passed=7, failed=1) -def test_markdown_nested(testdir): - testdir.copy_example("nested/nested.md") - testdir.mkdir("nested") - md = testdir.tmpdir / "nested.md" - md.move(testdir.tmpdir / "nested" / "nested.md") - testdir.copy_example("markdown.md") - result = testdir.runpytest("-v", "--check-links") +def test_markdown_nested(pytester): + pytester.copy_example("nested/nested.md") + pytester.mkdir("nested") + md = pytester.path / "nested.md" + shutil.move(md, pytester.path / "nested" / "nested.md") + pytester.copy_example("markdown.md") + result = pytester.runpytest_subprocess("-v", "--check-links") result.assert_outcomes(passed=8, failed=3) - result = testdir.runpytest( + result = pytester.runpytest_subprocess( "-v", "--check-links", "--check-links-ignore", "http.*example.com/.*" ) result.assert_outcomes(passed=8, failed=1) @skip_pywin32 -def test_rst(testdir): - testdir.copy_example("rst.rst") - result = testdir.runpytest("-v", "--check-links") +def test_rst(pytester): + pytester.copy_example("rst.rst") + result = pytester.runpytest_subprocess("-v", "--check-links") result.assert_outcomes(passed=7, failed=2) @skip_pywin32 -def test_rst_nested(testdir): - testdir.copy_example("nested/nested.rst") - testdir.mkdir("nested") - rst = testdir.tmpdir / "nested.rst" - rst.move(testdir.tmpdir / "nested" / "nested.rst") - testdir.copy_example("rst.rst") - result = testdir.runpytest("-v", "--check-links") +def test_rst_nested(pytester): + pytester.copy_example("nested/nested.rst") + pytester.mkdir("nested") + rst = pytester.path / "nested.rst" + shutil.move(rst, pytester.path / "nested" / "nested.rst") + pytester.copy_example("rst.rst") + result = pytester.runpytest_subprocess("-v", "--check-links") result.assert_outcomes(passed=13, failed=5) -def test_link_ext(testdir): - testdir.copy_example("linkcheck.ipynb") - testdir.copy_example("rst.rst") - testdir.copy_example("markdown.md") - result = testdir.runpytest("-v", "--check-links", "--links-ext=md,ipynb") +def test_link_ext(pytester): + pytester.copy_example("linkcheck.ipynb") + pytester.copy_example("rst.rst") + pytester.copy_example("markdown.md") + result = pytester.runpytest_subprocess("-v", "--check-links", "--links-ext=md,ipynb") result.assert_outcomes(passed=10, failed=7) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest_check_links-0.8.0/test/test_cli.py new/pytest_check_links-0.9.0/test/test_cli.py --- old/pytest_check_links-0.8.0/test/test_cli.py 2020-02-02 01:00:00.000000000 +0100 +++ new/pytest_check_links-0.9.0/test/test_cli.py 2020-02-02 01:00:00.000000000 +0100 @@ -2,10 +2,11 @@ import subprocess import pytest +from flaky import flaky # type:ignore def run(cmd, rc=0): - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # noqa stdout, stderr = proc.communicate() output = stdout.decode("utf-8").strip().splitlines() err = stderr.decode("utf-8").strip().splitlines() @@ -21,6 +22,7 @@ run(["pytest-check-links", "--help"]) +@flaky @pytest.mark.skipif(os.name != "nt", reason="Only works on Windows") @pytest.mark.parametrize( "example,rc,expected,unexpected",