Skip to content

test: Fix for import errors on plugins when executing isolated tests #24

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AmeyaVS
Copy link
Contributor

@AmeyaVS AmeyaVS commented Mar 30, 2024

  • import test_settings for fails in certain pytest invocation when running locally
    • The failing scenario is when triggering to execute individual tests:
    pytest --rootdir=$PWD package/test/test_VersionedPlugin.py
  • Replaced TEST_MESSAGE with logging.debug as per the implementation in test_settings.py

Snippet of the error when using the above mentioned pytest command:

ERROR    yapsy:PluginManager.py:518 Unable to import plugin: /home/ameya/plugins/yapsy/package/test/plugins/VersionedPlugin12a1
Traceback (most recent call last):
  File "/home/ameya/plugins/yapsy/package/yapsy/PluginManager.py", line 515, in loadPlugins
    candidate_module = PluginManager._importModule(plugin_module_name, candidate_filepath)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ameya/plugins/yapsy/package/yapsy/PluginManager.py", line 587, in _importModule
    spec.loader.exec_module(candidate_module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/ameya/plugins/yapsy/package/test/plugins/VersionedPlugin12a1.py", line 8, in <module>
    from test_settings import TEST_MESSAGE
ModuleNotFoundError: No module named 'test_settings

* import test_settings for fails in certain pytest invocation when running locally
* replace TEST_MESSAGE with logging.debug as per the implementation in test_settings
@coveralls
Copy link

coveralls commented Mar 30, 2024

Coverage Status

coverage: 91.461% (-0.03%) from 91.489%
when pulling ee8cbea on AmeyaVS:fix_isolated_test_run
into 6b487b0 on tibonihoo:master.

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 this pull request may close these issues.

2 participants