From: Kathara Sasikumar <katharasasikumar007@gmail.com>
Date: Sun, 11 Aug 2024 15:35:22 +0530
Subject: tests: Let test test_plugin_disabled() fail

While the autopkgtest run pytest itself will use a different root for
the libraries and PYTHONPATH, this will raise then this error message:

pytester = <Pytester PosixPath('/tmp/pytest-of-root/pytest-3/test_plugin_disabled0')>

    def test_plugin_disabled(pytester: pytest.Pytester) -> None:
        pytester.copy_example("tests/examples/test_addition_fixture.py")
        result = pytester.runpytest()
>       result.stdout.fnmatch_lines(["*1 passed*"])
E       Failed: nomatch: '*1 passed*'
E           and: '============================= test session starts =============================='
E           and: 'platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0'
E           and: 'codspeed: 2.2.1 (callgraph: enabled)'
E           and: 'benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)'
E           and: 'rootdir: /tmp/pytest-of-root/pytest-3/test_plugin_disabled0'
E           and: 'plugins: benchmark-4.0.0, codspeed-2.2.1, Faker-26.0.0'
E           and: 'collected 0 items / 1 error'
E           and: ''
E           and: '==================================== ERRORS ===================================='
E           and: '__________________ ERROR collecting test_addition_fixture.py ___________________'
E           and: 'import file mismatch:'
E           and: "imported module 'test_addition_fixture' has this __file__ attribute:"
E           and: '  /tmp/tests/tests/examples/test_addition_fixture.py'
E           and: 'which is not the same as the test file we want to collect:'
E           and: '  /tmp/pytest-of-root/pytest-3/test_plugin_disabled0/test_addition_fixture.py'
E           and: 'HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules'
E           and: '=========================== short test summary info ============================'
E           and: 'ERROR test_addition_fixture.py'
E           and: '!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!'
E           and: '=============================== 1 error in 0.07s ==============================='
E       remains unmatched: '*1 passed*'

/build/pytest-codspeed-2.2.1/tests/test_pytest_plugin.py:168: Failed

It's o.k. this test will fail in the autopkgtest.

Forwarded: not-needed
---
 tests/test_pytest_plugin.py | 1 +
 1 file changed, 1 insertion(+)

--- a/tests/test_pytest_plugin.py
+++ b/tests/test_pytest_plugin.py
@@ -119,6 +119,7 @@
     )
 
 
+@pytest.mark.xfail(reason="Expected to fail in autopkgtest due import path missmatch")
 def test_plugin_disabled(pytester: pytest.Pytester) -> None:
     pytester.copy_example("tests/examples/test_addition_fixture.py")
     result = pytester.runpytest()
