Skip to content

RFE: adapt exsting test suite to pytest #4319

Open
@kloczek

Description

@kloczek

Describe the bug
Looks like pyetst is failing because it cannot find TestCmd module.

Required information

  • Version of SCons: 4.5.
  • Version of Python: 3.8.16
  • How you installed SCons: N/A
  • What Platform are you on? Linux x86/64
  • How to reproduce your issue?
  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
  • How you invoke scons (The command line you're using "scons --flags some_arguments")
    N/A

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-scons-4.5.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-scons-4.5.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.16, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/scons-4.5.1
collected 0 items / 5 errors

==================================== ERRORS ====================================
______________________ ERROR collecting src/test_files.py ______________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/scons-4.5.1/src/test_files.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
src/test_files.py:38: in <module>
    import TestSCons
E   ModuleNotFoundError: No module named 'TestSCons'
___________________ ERROR collecting src/test_interrupts.py ____________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/scons-4.5.1/src/test_interrupts.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
src/test_interrupts.py:36: in <module>
    import TestSCons
E   ModuleNotFoundError: No module named 'TestSCons'
____________________ ERROR collecting src/test_pychecker.py ____________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/scons-4.5.1/src/test_pychecker.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
src/test_pychecker.py:33: in <module>
    import TestSCons
E   ModuleNotFoundError: No module named 'TestSCons'
______________________ ERROR collecting src/test_setup.py ______________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/scons-4.5.1/src/test_setup.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
src/test_setup.py:41: in <module>
    import TestSCons
E   ModuleNotFoundError: No module named 'TestSCons'
_____________________ ERROR collecting src/test_strings.py _____________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/scons-4.5.1/src/test_strings.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
src/test_strings.py:39: in <module>
    import TestCmd
E   ModuleNotFoundError: No module named 'TestCmd'
=========================== short test summary info ============================
ERROR src/test_files.py
ERROR src/test_interrupts.py
ERROR src/test_pychecker.py
ERROR src/test_setup.py
ERROR src/test_strings.py
!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 5 errors in 1.11s ===============================

I see that module in the tree however look like it has location which does not allow use pytest

[tkloczko@pers-jacek scons-4.5.1]$ find . -name TestCmd\*
./testing/framework/TestCmd.py
./testing/framework/TestCmdTests.py

It woild be nice to have possibility to test scons using pytest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementtestsuiteThings that only affect the SCons testing. Do not use just because a PR has tests.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions