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

Running unit tests with Pytest is pulling in functional test requirements #4751

Closed
dralley opened this issue Nov 21, 2023 · 0 comments · Fixed by #4851
Closed

Running unit tests with Pytest is pulling in functional test requirements #4751

dralley opened this issue Nov 21, 2023 · 0 comments · Fixed by #4851
Assignees
Labels

Comments

@dralley
Copy link
Contributor

dralley commented Nov 21, 2023

Describe the bug

I should be able to exclusively run the unit tests without issues. However, it seems we're getting caught up on a pytest plugin that gets loaded, which then pulls in the functional test code, making the separation between unit tests and functional tests moot.

root@5531d25eaa6e pulp_rpm]# pytest -v -r sx --color=yes pulp_rpm/tests/unit/
Traceback (most recent call last):
  File "/usr/local/bin/pytest", line 8, in <module>
    sys.exit(console_main())
  File "/usr/local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 192, in console_main
    code = main()
  File "/usr/local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 150, in main
    config = _prepareconfig(args, plugins)
  File "/usr/local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 331, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/usr/local/lib/python3.8/site-packages/pluggy/_hooks.py", line 493, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "/usr/local/lib/python3.8/site-packages/pluggy/_manager.py", line 115, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/usr/local/lib/python3.8/site-packages/pluggy/_callers.py", line 130, in _multicall
    teardown[0].send(outcome)
  File "/usr/local/lib/python3.8/site-packages/_pytest/helpconfig.py", line 104, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/usr/local/lib/python3.8/site-packages/pluggy/_result.py", line 114, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "/usr/local/lib/python3.8/site-packages/pluggy/_callers.py", line 77, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1075, in pytest_cmdline_parse
    self.parse(args)
  File "/usr/local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1425, in parse
    self._preparse(args, addopts=addopts)
  File "/usr/local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1305, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/usr/local/lib/python3.8/site-packages/pluggy/_manager.py", line 398, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/usr/lib64/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/src/pulpcore/pulp_file/pytest_plugin.py", line 21, in <module>
    from pulpcore.tests.functional.utils import generate_iso, generate_manifest
  File "/src/pulpcore/pulpcore/tests/functional/__init__.py", line 25, in <module>
    from pulpcore.tests.functional.utils import (
  File "/src/pulpcore/pulpcore/tests/functional/utils.py", line 22, in <module>
    from pulp_smash.pulp3.bindings import PulpTaskError, PulpTaskGroupError
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/usr/local/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 186, in exec_module
    exec(co, module.__dict__)
  File "/usr/local/lib/python3.8/site-packages/pulp_smash/pulp3/bindings.py", line 15, in <module>
    cfg = get_config()
  File "/usr/local/lib/python3.8/site-packages/pulp_smash/config.py", line 242, in get_config
    _CONFIG = PulpSmashConfig.load()
  File "/usr/local/lib/python3.8/site-packages/pulp_smash/config.py", line 553, in load
    path = cls.get_load_path(xdg_subdir, config_file)
  File "/usr/local/lib/python3.8/site-packages/pulp_smash/config.py", line 616, in get_load_path
    raise exceptions.ConfigFileNotFoundError(
pulp_smash.exceptions.ConfigFileNotFoundError: /opt/settings/pulp_smash/settings.jsonPulp Smash is unable to find a configuration file. The following (XDG compliant) paths have been searched: , /etc/xdg/pulp_smash/settings.json

I think this pins it down a bit

  File "/src/pulpcore/pulp_file/pytest_plugin.py", line 21, in <module>
    from pulpcore.tests.functional.utils import generate_iso, generate_manifest
  File "/src/pulpcore/pulpcore/tests/functional/__init__.py", line 25, in <module>
    from pulpcore.tests.functional.utils import (
  File "/src/pulpcore/pulpcore/tests/functional/utils.py", line 22, in <module>
    from pulp_smash.pulp3.bindings import PulpTaskError, PulpTaskGroupError

To Reproduce

Run pytest -v -r sx --color=yes {project}/tests/unit/

Additional context
Add any other context about the problem here. Please provide links to any previous discussions via Discourse or Bugzilla.

@mdellweg mdellweg self-assigned this Dec 11, 2023
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 11, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
@mdellweg mdellweg linked a pull request Dec 11, 2023 that will close this issue
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 12, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 12, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 12, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 12, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 12, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 12, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 12, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 12, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 12, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 12, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 14, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 14, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 16, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit to mdellweg/pulpcore that referenced this issue Dec 16, 2023
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes pulp#4751
mdellweg added a commit that referenced this issue Jan 9, 2024
This also provides new pulpcore_bindings and file_bindings fixtures that
will provide all the bindings apis preconfigured.

fixes #4751
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants