Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.9.0: pytest is failing #64

Open
kloczek opened this issue Jan 2, 2022 · 10 comments · Fixed by #70
Open

0.9.0: pytest is failing #64

kloczek opened this issue Jan 2, 2022 · 10 comments · Fixed by #70

Comments

@kloczek
Copy link

kloczek commented Jan 2, 2022

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
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

I have alredy packaged almost 800 python modules ane to be honest I see first time such errors. Liooks like something is wrong with importing modules.
May I ask for some help?
Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --import-mode=importlib
=========================================================================== 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/kajiki-0.9.0, configfile: pytest.ini
collected 158 items / 20 errors / 138 selected

================================================================================== ERRORS ==================================================================================
___________________________________________________________________ ERROR collecting kajiki/__main__.py ____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.__main__', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/__main__.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/__main__.py'))
____________________________________________________________________ ERROR collecting kajiki/doctype.py ____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.doctype', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/doctype.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/doctype.py'))
__________________________________________________________________ ERROR collecting kajiki/html_utils.py ___________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.html_utils', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/html_utils.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/html_utils.py'))
_____________________________________________________________________ ERROR collecting kajiki/i18n.py ______________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.i18n', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/i18n.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/i18n.py'))
______________________________________________________________________ ERROR collecting kajiki/ir.py _______________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.ir', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/ir.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/ir.py'))
____________________________________________________________________ ERROR collecting kajiki/lnotab.py _____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.lnotab', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/lnotab.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/lnotab.py'))
____________________________________________________________________ ERROR collecting kajiki/loader.py _____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.loader', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/loader.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/loader.py'))
________________________________________________________________ ERROR collecting kajiki/markup_template.py ________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.markup_template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/markup_template.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/markup_template.py'))
___________________________________________________________________ ERROR collecting kajiki/template.py ____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/template.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/template.py'))
_____________________________________________________________________ ERROR collecting kajiki/text.py ______________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.text', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/text.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/text.py'))
_____________________________________________________________________ ERROR collecting kajiki/util.py ______________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.util', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/util.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/util.py'))
____________________________________________________________________ ERROR collecting kajiki/version.py ____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.version', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/version.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/version.py'))
_________________________________________________________________ ERROR collecting kajiki/xml_template.py __________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.xml_template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/xml_template.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/xml_template.py'))
________________________________________________________________ ERROR collecting kajiki/tests/test_cli.py _________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_cli', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/tests/test_cli.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/tests/test_cli.py'))
______________________________________________________________ ERROR collecting kajiki/tests/test_doctype.py _______________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_doctype', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/tests/test_doctype.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/tests/test_doctype.py'))
________________________________________________________________ ERROR collecting kajiki/tests/test_e2e.py _________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_e2e', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/tests/test_e2e.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/tests/test_e2e.py'))
_________________________________________________________________ ERROR collecting kajiki/tests/test_ir.py _________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_ir', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/tests/test_ir.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/tests/test_ir.py'))
______________________________________________________________ ERROR collecting kajiki/tests/test_runtime.py _______________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_runtime', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/tests/test_runtime.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/tests/test_runtime.py'))
________________________________________________________________ ERROR collecting kajiki/tests/test_text.py ________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_text', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/tests/test_text.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/tests/test_text.py'))
________________________________________________________________ ERROR collecting kajiki/tests/test_xml.py _________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_xml', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/tests/test_xml.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.0/kajiki/tests/test_xml.py'))
========================================================================= short test summary info ==========================================================================
ERROR kajiki/__main__.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.__main__', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/pyth...
ERROR kajiki/doctype.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.doctype', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python...
ERROR kajiki/html_utils.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.html_utils', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/...
ERROR kajiki/i18n.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.i18n', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/si...
ERROR kajiki/ir.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.ir', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/site-p...
ERROR kajiki/lnotab.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.lnotab', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3....
ERROR kajiki/loader.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.loader', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3....
ERROR kajiki/markup_template.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.markup_template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_6...
ERROR kajiki/template.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/pyth...
ERROR kajiki/text.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.text', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/si...
ERROR kajiki/util.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.util', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python3.8/si...
ERROR kajiki/version.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.version', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/lib/python...
ERROR kajiki/xml_template.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.xml_template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/usr/...
ERROR kajiki/tests/test_cli.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_cli', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/...
ERROR kajiki/tests/test_doctype.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_doctype', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35...
ERROR kajiki/tests/test_e2e.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_e2e', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/...
ERROR kajiki/tests/test_ir.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_ir', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/us...
ERROR kajiki/tests/test_runtime.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_runtime', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35...
ERROR kajiki/tests/test_text.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_text', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_6...
ERROR kajiki/tests/test_xml.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.tests.test_xml', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.0-5.fc35.x86_64/...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 20 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================ 20 errors in 1.75s ===========================================================================
@jackrosenthal
Copy link
Owner

I believe that this is https://tox.wiki/en/latest/example/pytest.html#known-issues-and-limitations.

The issue is that the tests themselves are at both in the checkout and at the installed location. One fix is to explicitly pass the installed location as the directory to run tests from:

PYTHONPATH=/tmp/install/usr/lib/python3.10/site-packages pytest -ra --import-mode=importlib /tmp/install/usr/lib/python3.10/site-packages/kajiki
===================================================================== test session starts ======================================================================
platform linux -- Python 3.10.1, pytest-6.2.5, py-1.11.0, pluggy-0.13.1
rootdir: /tmp/install/usr/lib/python3.10/site-packages/kajiki
collected 154 items                                                                                                                                            

../../../tmp/install/usr/lib/python3.10/site-packages/kajiki/tests/test_cli.py ........                                                                  [  5%]
../../../tmp/install/usr/lib/python3.10/site-packages/kajiki/tests/test_doctype.py ..                                                                    [  6%]
../../../tmp/install/usr/lib/python3.10/site-packages/kajiki/tests/test_e2e.py ....                                                                      [  9%]
../../../tmp/install/usr/lib/python3.10/site-packages/kajiki/tests/test_ir.py ........                                                                   [ 14%]
../../../tmp/install/usr/lib/python3.10/site-packages/kajiki/tests/test_runtime.py ........                                                              [ 19%]
../../../tmp/install/usr/lib/python3.10/site-packages/kajiki/tests/test_text.py ........................                                                 [ 35%]
../../../tmp/install/usr/lib/python3.10/site-packages/kajiki/tests/test_xml.py ......................................................................... [ 82%]
...........................                                                                                                                              [100%]

======================================================================= warnings summary =======================================================================
../../../usr/lib/python3.10/site-packages/packaging/version.py:127: 712 warnings
  /usr/lib/python3.10/site-packages/packaging/version.py:127: DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/warnings.html
============================================================== 154 passed, 712 warnings in 0.29s ===============================================================

In a future version, we could move tests outside of the install path, which was probably a holdout from using the nose test runner. This is more typical for pytest usage.

@kloczek
Copy link
Author

kloczek commented Apr 6, 2022

Gentle ping .. any update? 😄

@kloczek
Copy link
Author

kloczek commented Apr 20, 2022

Just tested new 0.9.1 and lokks like still somthing is wrong.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1, configfile: pytest.ini
plugins: datadir-1.3.1, regressions-2.3.1, cov-3.0.0, httpserver-1.0.4, mock-3.7.0, asyncio-0.18.2
asyncio: mode=legacy
collected 158 items / 12 errors

================================================================================== ERRORS ==================================================================================
____________________________________________________________________ ERROR collecting kajiki/doctype.py ____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.doctype', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/doctype.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/doctype.py'))
__________________________________________________________________ ERROR collecting kajiki/html_utils.py ___________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.html_utils', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/html_utils.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/html_utils.py'))
_____________________________________________________________________ ERROR collecting kajiki/i18n.py ______________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.i18n', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/i18n.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/i18n.py'))
______________________________________________________________________ ERROR collecting kajiki/ir.py _______________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.ir', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/ir.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/ir.py'))
____________________________________________________________________ ERROR collecting kajiki/lnotab.py _____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.lnotab', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/lnotab.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/lnotab.py'))
____________________________________________________________________ ERROR collecting kajiki/loader.py _____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.loader', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/loader.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/loader.py'))
________________________________________________________________ ERROR collecting kajiki/markup_template.py ________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.markup_template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/markup_template.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/markup_template.py'))
___________________________________________________________________ ERROR collecting kajiki/template.py ____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/template.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/template.py'))
_____________________________________________________________________ ERROR collecting kajiki/text.py ______________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.text', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/text.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/text.py'))
_____________________________________________________________________ ERROR collecting kajiki/util.py ______________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.util', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/util.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/util.py'))
____________________________________________________________________ ERROR collecting kajiki/version.py ____________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.version', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/version.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/version.py'))
_________________________________________________________________ ERROR collecting kajiki/xml_template.py __________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:369: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:545: in collect
    module = import_path(self.path, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:556: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('kajiki.xml_template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/xml_template.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/kajiki/xml_template.py'))
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:191
  /usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:191: DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.
    config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
ERROR kajiki/doctype.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.doctype', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python...
ERROR kajiki/html_utils.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.html_utils', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/...
ERROR kajiki/i18n.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.i18n', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/si...
ERROR kajiki/ir.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.ir', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-p...
ERROR kajiki/lnotab.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.lnotab', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3....
ERROR kajiki/loader.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.loader', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3....
ERROR kajiki/markup_template.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.markup_template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_6...
ERROR kajiki/template.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/pyth...
ERROR kajiki/text.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.text', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/si...
ERROR kajiki/util.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.util', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/si...
ERROR kajiki/version.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.version', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python...
ERROR kajiki/xml_template.py - _pytest.pathlib.ImportPathMismatchError: ('kajiki.xml_template', '/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 12 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================== 1 warning, 12 errors in 0.92s =======================================================================

That warning is possible to fix by patch

--- a/pytest.ini~       2022-04-20 20:06:22.000000000 +0000
+++ b/pytest.ini        2022-04-20 20:31:25.336739128 +0000
@@ -1,4 +1,5 @@
 [pytest]
+asyncio_mode = auto
 addopts =
     --doctest-modules
     --doctest-glob=*.rst

@jackrosenthal
Copy link
Owner

jackrosenthal commented Apr 20, 2022

Is the goal to test the copy in /home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1 (the source checkout), or in /home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages (the install path)?

@kloczek
Copy link
Author

kloczek commented Apr 20, 2022

I think that I found solution. I've started pytest with --pyargs kajiki and seens pytest was able to find necessary modules.

+ /usr/bin/pytest -ra --pyargs kajiki
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1, configfile: pytest.ini
plugins: asyncio-0.18.2
asyncio: mode=auto
collected 2 items / 1 error

================================================================================== ERRORS ==================================================================================
_________________________________________________________________ ERROR collecting integration/pyramid.py __________________________________________________________________
../../BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/kajiki/integration/pyramid.py:33: in <module>
    from pyramid.interfaces import IRenderer, ITemplateRenderer
E   ModuleNotFoundError: No module named 'pyramid'
========================================================================= short test summary info ==========================================================================
ERROR integration/pyramid.py - ModuleNotFoundError: No module named 'pyramid'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 error in 0.73s =============================================================================

Looks like pytest,ini needs to be adjusted.
Now I need to package pyramid but this is not relevant to this ticket.
If I'll not back it will mean that after adding to my build env missing modules I did not found any other issues 😃

@jackrosenthal
Copy link
Owner

I don't think you meant to use --pyargs kajiki ... this tells pytest to run tests found by collecting from the kajiki package, which doesn't have any tests in the package anymore (they were moved to the tests directory).

Perhaps you wanted to run pytest /home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/tests?

@kloczek
Copy link
Author

kloczek commented Apr 21, 2022

I don't think you meant to use --pyargs kajiki ... this tells pytest to run tests found by collecting from the kajiki package, which doesn't have any tests in the package anymore (they were moved to the tests directory).

Yep you are right. My mistake.

Perhaps you wanted to run pytest /home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1/tests?

+ /usr/bin/pytest -ra tests
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1, configfile: pytest.ini
plugins: asyncio-0.18.2
asyncio: mode=auto
collected 154 items

tests/test_cli.py ........                                                                                                                                           [  5%]
tests/test_doctype.py ..                                                                                                                                             [  6%]
tests/test_e2e.py ....                                                                                                                                               [  9%]
tests/test_ir.py ........                                                                                                                                            [ 14%]
tests/test_runtime.py ........                                                                                                                                       [ 19%]
tests/test_text.py ........................                                                                                                                          [ 35%]
tests/test_xml.py ....................................................................................................                                               [100%]

=========================================================================== 154 passed in 0.72s ============================================================================

So that works and it means that this test directory should be specified in pytest.ini to not force anyone to check where are the test units.

@kloczek
Copy link
Author

kloczek commented Apr 21, 2022

So with final pytest.ini patch:

--- a/pytest.ini~       2022-04-20 20:06:22.000000000 +0000
+++ b/pytest.ini        2022-04-21 00:16:59.940514025 +0000
@@ -5,4 +5,6 @@
     --ignore=speedtest.py
     --ignore=release_new_version.py
     --ignore=kajiki/integration/pyramid.py
+asyncio_mode = auto
 doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL
+testpaths = tests

it is possible to run pytest without any parameters

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1, configfile: pytest.ini, testpaths: tests
plugins: asyncio-0.18.2
asyncio: mode=auto
collected 154 items

tests/test_cli.py ........                                                                                                                                           [  5%]
tests/test_doctype.py ..                                                                                                                                             [  6%]
tests/test_e2e.py ....                                                                                                                                               [  9%]
tests/test_ir.py ........                                                                                                                                            [ 14%]
tests/test_runtime.py ........                                                                                                                                       [ 19%]
tests/test_text.py ........................                                                                                                                          [ 35%]
tests/test_xml.py ....................................................................................................                                               [100%]

=========================================================================== 154 passed in 0.75s ============================================================================

jackrosenthal added a commit that referenced this issue Apr 21, 2022
Enabling --doctest-modules seems to cause the ImportPathMismatchError
mentioned in Issue #64.  The only two doctests in the modules can be
found in doctype.py, and they don't seem to provide any additional
coverage to what is already in test_doctype.py, therefore let's just
disable them.
@jackrosenthal
Copy link
Owner

Does commit 6dd9edd work out for you?

@jackrosenthal jackrosenthal reopened this Apr 21, 2022
@kloczek
Copy link
Author

kloczek commented Apr 21, 2022

Tested. pytest found 4 units more.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-kajiki-0.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/kajiki-0.9.1, configfile: pytest.ini
collected 158 items

README.rst .                                                                                                                                                         [  0%]
docs/templating-basics.rst .                                                                                                                                         [  1%]
docs/text-templates.rst .                                                                                                                                            [  1%]
docs/xml-templates.rst .                                                                                                                                             [  2%]
tests/test_cli.py ........                                                                                                                                           [  7%]
tests/test_doctype.py ..                                                                                                                                             [  8%]
tests/test_e2e.py ....                                                                                                                                               [ 11%]
tests/test_ir.py ........                                                                                                                                            [ 16%]
tests/test_runtime.py ........                                                                                                                                       [ 21%]
tests/test_text.py ........................                                                                                                                          [ 36%]
tests/test_xml.py ....................................................................................................                                               [100%]

=========================================================================== 158 passed in 0.75s ============================================================================

I've removed pytest-asyncio from build dependencies so there is no that warning (for some reasons I had it in package BuildRequires)

CastixGitHub pushed a commit to CastixGitHub/kajiki that referenced this issue Jun 16, 2022
CastixGitHub pushed a commit to CastixGitHub/kajiki that referenced this issue Jun 16, 2022
Enabling --doctest-modules seems to cause the ImportPathMismatchError
mentioned in Issue jackrosenthal#64.  The only two doctests in the modules can be
found in doctype.py, and they don't seem to provide any additional
coverage to what is already in test_doctype.py, therefore let's just
disable them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants