I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
- install .whl file in </install/prefix>
- run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
May I ask where I can find that is_always_missing
module? I canmot find it on pypi :/
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-mypy-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-mypy-0.8.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1, configfile: tox.ini, testpaths: tests
plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7
collected 50 items
tests/test_pytest_mypy.py ............FFF................................... [100%]
================================================================================= FAILURES =================================================================================
_________________________________________________________________ test_mypy_ignore_missings_imports[True] __________________________________________________________________
testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports0')>, xdist_args = ['-n', 'auto']
def test_mypy_ignore_missings_imports(testdir, xdist_args):
"""
Verify that --mypy-ignore-missing-imports
causes mypy to ignore missing imports.
"""
module_name = "is_always_missing"
testdir.makepyfile(
"""
try:
import {module_name}
except ImportError:
pass
""".format(
module_name=module_name,
),
)
result = testdir.runpytest_subprocess("--mypy", *xdist_args)
mypy_file_checks = 1
mypy_status_check = 1
mypy_checks = mypy_file_checks + mypy_status_check
result.assert_outcomes(failed=mypy_checks)
> result.stdout.fnmatch_lines(
[
"2: error: Cannot find *module named '{module_name}'".format(
module_name=module_name,
),
],
)
E Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0'
E and: 'rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports0'
E and: 'plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7'
E and: 'gw0 I / gw1 I / gw2 I / gw3 I / gw4 I / gw5 I / gw6 I / gw7 I / gw8 I / gw9 I / gw10 I / gw11 I'
E and: 'gw0 [2] / gw1 [2] / gw2 [2] / gw3 [2] / gw4 [2] / gw5 [2] / gw6 [2] / gw7 [2] / gw8 [2] / gw9 [2] / gw10 [2] / gw11 [2]'
E and: ''
E and: 'FF [100%]'
E and: '=================================== FAILURES ==================================='
E and: '_________________________________ test session _________________________________'
E and: '[gw1] linux -- Python 3.8.12 /usr/bin/python3'
E and: 'mypy exited with status 1.'
E and: '_____________________ test_mypy_ignore_missings_imports.py _____________________'
E and: '[gw0] linux -- Python 3.8.12 /usr/bin/python3'
E and: '2: error: Cannot find implementation or library stub for module named "is_always_missing"'
E and: '2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports'
E and: '===================================== mypy ====================================='
E and: 'Found 1 error in 1 file (checked 1 source file)'
E and: '=========================== short test summary info ============================'
E and: 'FAILED test_mypy_ignore_missings_imports.py::mypy-status'
E and: 'FAILED test_mypy_ignore_missings_imports.py::mypy'
E and: '============================== 2 failed in 13.08s =============================='
E remains unmatched: "2: error: Cannot find *module named 'is_always_missing'"
/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:119: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports0/runpytest-0 --mypy -n auto
in: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports0
============================= test session starts ==============================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports0
plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7
gw0 I / gw1 I / gw2 I / gw3 I / gw4 I / gw5 I / gw6 I / gw7 I / gw8 I / gw9 I / gw10 I / gw11 I
gw0 [2] / gw1 [2] / gw2 [2] / gw3 [2] / gw4 [2] / gw5 [2] / gw6 [2] / gw7 [2] / gw8 [2] / gw9 [2] / gw10 [2] / gw11 [2]
FF [100%]
=================================== FAILURES ===================================
_________________________________ test session _________________________________
[gw1] linux -- Python 3.8.12 /usr/bin/python3
mypy exited with status 1.
_____________________ test_mypy_ignore_missings_imports.py _____________________
[gw0] linux -- Python 3.8.12 /usr/bin/python3
2: error: Cannot find implementation or library stub for module named "is_always_missing"
2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
===================================== mypy =====================================
Found 1 error in 1 file (checked 1 source file)
=========================== short test summary info ============================
FAILED test_mypy_ignore_missings_imports.py::mypy-status
FAILED test_mypy_ignore_missings_imports.py::mypy
============================== 2 failed in 13.08s ==============================
_________________________________________________________________ test_mypy_ignore_missings_imports[False] _________________________________________________________________
testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports1')>, xdist_args = []
def test_mypy_ignore_missings_imports(testdir, xdist_args):
"""
Verify that --mypy-ignore-missing-imports
causes mypy to ignore missing imports.
"""
module_name = "is_always_missing"
testdir.makepyfile(
"""
try:
import {module_name}
except ImportError:
pass
""".format(
module_name=module_name,
),
)
result = testdir.runpytest_subprocess("--mypy", *xdist_args)
mypy_file_checks = 1
mypy_status_check = 1
mypy_checks = mypy_file_checks + mypy_status_check
result.assert_outcomes(failed=mypy_checks)
> result.stdout.fnmatch_lines(
[
"2: error: Cannot find *module named '{module_name}'".format(
module_name=module_name,
),
],
)
E Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0'
E and: 'rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports1'
E and: 'plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7'
E and: 'collected 2 items'
E and: ''
E and: 'test_mypy_ignore_missings_imports.py FF [100%]'
E and: ''
E and: '=================================== FAILURES ==================================='
E and: '_____________________ test_mypy_ignore_missings_imports.py _____________________'
E and: '2: error: Cannot find implementation or library stub for module named "is_always_missing"'
E and: '2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports'
E and: '_________________________________ test session _________________________________'
E and: 'mypy exited with status 1.'
E and: '===================================== mypy ====================================='
E and: 'Found 1 error in 1 file (checked 1 source file)'
E and: '=========================== short test summary info ============================'
E and: 'FAILED test_mypy_ignore_missings_imports.py::mypy'
E and: 'FAILED test_mypy_ignore_missings_imports.py::mypy-status'
E and: '============================== 2 failed in 11.33s =============================='
E remains unmatched: "2: error: Cannot find *module named 'is_always_missing'"
/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:119: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports1/runpytest-0 --mypy
in: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports1
============================= test session starts ==============================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports1
plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7
collected 2 items
test_mypy_ignore_missings_imports.py FF [100%]
=================================== FAILURES ===================================
_____________________ test_mypy_ignore_missings_imports.py _____________________
2: error: Cannot find implementation or library stub for module named "is_always_missing"
2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
_________________________________ test session _________________________________
mypy exited with status 1.
===================================== mypy =====================================
Found 1 error in 1 file (checked 1 source file)
=========================== short test summary info ============================
FAILED test_mypy_ignore_missings_imports.py::mypy
FAILED test_mypy_ignore_missings_imports.py::mypy-status
============================== 2 failed in 11.33s ==============================
_________________________________________________________________ test_mypy_ignore_missings_imports[None] __________________________________________________________________
testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports2')>, xdist_args = ['-p', 'no:xdist']
def test_mypy_ignore_missings_imports(testdir, xdist_args):
"""
Verify that --mypy-ignore-missing-imports
causes mypy to ignore missing imports.
"""
module_name = "is_always_missing"
testdir.makepyfile(
"""
try:
import {module_name}
except ImportError:
pass
""".format(
module_name=module_name,
),
)
result = testdir.runpytest_subprocess("--mypy", *xdist_args)
mypy_file_checks = 1
mypy_status_check = 1
mypy_checks = mypy_file_checks + mypy_status_check
result.assert_outcomes(failed=mypy_checks)
> result.stdout.fnmatch_lines(
[
"2: error: Cannot find *module named '{module_name}'".format(
module_name=module_name,
),
],
)
E Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0'
E and: 'rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports2'
E and: 'plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7'
E and: 'collected 2 items'
E and: ''
E and: 'test_mypy_ignore_missings_imports.py FF [100%]'
E and: ''
E and: '=================================== FAILURES ==================================='
E and: '_____________________ test_mypy_ignore_missings_imports.py _____________________'
E and: '2: error: Cannot find implementation or library stub for module named "is_always_missing"'
E and: '2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports'
E and: '_________________________________ test session _________________________________'
E and: 'mypy exited with status 1.'
E and: '===================================== mypy ====================================='
E and: 'Found 1 error in 1 file (checked 1 source file)'
E and: '=========================== short test summary info ============================'
E and: 'FAILED test_mypy_ignore_missings_imports.py::mypy'
E and: 'FAILED test_mypy_ignore_missings_imports.py::mypy-status'
E and: '============================== 2 failed in 11.25s =============================='
E remains unmatched: "2: error: Cannot find *module named 'is_always_missing'"
/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:119: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports2/runpytest-0 --mypy -p no:xdist
in: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports2
============================= test session starts ==============================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports2
plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7
collected 2 items
test_mypy_ignore_missings_imports.py FF [100%]
=================================== FAILURES ===================================
_____________________ test_mypy_ignore_missings_imports.py _____________________
2: error: Cannot find implementation or library stub for module named "is_always_missing"
2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
_________________________________ test session _________________________________
mypy exited with status 1.
===================================== mypy =====================================
Found 1 error in 1 file (checked 1 source file)
=========================== short test summary info ============================
FAILED test_mypy_ignore_missings_imports.py::mypy
FAILED test_mypy_ignore_missings_imports.py::mypy-status
============================== 2 failed in 11.25s ==============================
========================================================================= short test summary info ==========================================================================
FAILED tests/test_pytest_mypy.py::test_mypy_ignore_missings_imports[True] - Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
FAILED tests/test_pytest_mypy.py::test_mypy_ignore_missings_imports[False] - Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
FAILED tests/test_pytest_mypy.py::test_mypy_ignore_missings_imports[None] - Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
================================================================= 3 failed, 47 passed in 588.13s (0:09:48) =================================================================