You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
I noticed that when I'm running unit tests (for example for the easyrsa charm) and charmhalpers package is installed in the virtual environment, some of the mocks do not work as expected and charmhelpers actually tries to "execute".
Running tests without charmhelpers installed (passed):
$ pytest tests/
========================================================= test session starts =========================================================
platform darwin -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /Users/kauchman/Work/canonical/code/charms/layer-easyrsa
collected 0 items / 2 errors
=============================================================== ERRORS ================================================================
_______________________________________________ ERROR collecting tests/test_actions.py ________________________________________________
tests/test_actions.py:22: in <module>
from actions import actions
actions/actions.py:12: in <module>
from charms.reactive.relations import endpoint_from_name
<frozen importlib._bootstrap>:1007: in _find_and_load
???
<frozen importlib._bootstrap>:982: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:925: in _find_spec
???
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charms/unit_test.py:139: in find_spec
file_spec = self.find_real(fullname)
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charms/unit_test.py:117: in find_real
file_spec = importlib.util.find_spec(fullname)
/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/util.py:94: in find_spec
parent = __import__(parent_name, fromlist=['__path__'])
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charms/reactive/__init__.py:22: in <module>
from .endpoints import * # noqa
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charms/reactive/endpoints.py:23: in <module>
from charms.reactive.helpers import data_changed
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charms/reactive/helpers.py:21: in <module>
from charmhelpers.core import host
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charmhelpers/core/host.py:42: in <module>
__platform__ = get_platform()
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charmhelpers/osplatform.py:18: in get_platform
current_platform = _get_platform_from_fs()
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charmhelpers/osplatform.py:41: in _get_platform_from_fs
with open(os.path.join(os.sep, 'etc', 'os-release')) as fin:
E FileNotFoundError: [Errno 2] No such file or directory: '/etc/os-release'
_______________________________________________ ERROR collecting tests/test_easyrsa.py ________________________________________________
tests/test_easyrsa.py:1: in <module>
from reactive import easyrsa
reactive/easyrsa.py:11: in <module>
from charms.reactive.helpers import data_changed
<frozen importlib._bootstrap>:1007: in _find_and_load
???
<frozen importlib._bootstrap>:982: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:925: in _find_spec
???
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charms/unit_test.py:139: in find_spec
file_spec = self.find_real(fullname)
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charms/unit_test.py:117: in find_real
file_spec = importlib.util.find_spec(fullname)
/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/util.py:94: in find_spec
parent = __import__(parent_name, fromlist=['__path__'])
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charms/reactive/__init__.py:22: in <module>
from .endpoints import * # noqa
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charms/reactive/endpoints.py:23: in <module>
from charms.reactive.helpers import data_changed
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charms/reactive/helpers.py:21: in <module>
from charmhelpers.core import host
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charmhelpers/core/host.py:42: in <module>
__platform__ = get_platform()
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charmhelpers/osplatform.py:18: in get_platform
current_platform = _get_platform_from_fs()
../../venvs/layer-easyrsa/lib/python3.9/site-packages/charmhelpers/osplatform.py:41: in _get_platform_from_fs
with open(os.path.join(os.sep, 'etc', 'os-release')) as fin:
E FileNotFoundError: [Errno 2] No such file or directory: '/etc/os-release'
======================================================= short test summary info =======================================================
ERROR tests/test_actions.py - FileNotFoundError: [Errno 2] No such file or directory: '/etc/os-release'
ERROR tests/test_easyrsa.py - FileNotFoundError: [Errno 2] No such file or directory: '/etc/os-release'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================== 2 errors in 0.38s ==========================================================
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I noticed that when I'm running unit tests (for example for the easyrsa charm) and
charmhalpers
package is installed in the virtual environment, some of the mocks do not work as expected andcharmhelpers
actually tries to "execute".Running tests without
charmhelpers
installed (passed):Running tests with
charmhelpers
installed (fail):The text was updated successfully, but these errors were encountered: