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

The sole test does not seem to work #16

Open
musicinmybrain opened this issue Jul 2, 2023 · 1 comment
Open

The sole test does not seem to work #16

musicinmybrain opened this issue Jul 2, 2023 · 1 comment
Assignees

Comments

@musicinmybrain
Copy link
Contributor

python3.11 -m venv _e
. _e/bin/activate
pip install -e .
pip install pytest
python -m pytest
============================= test session starts ==============================
platform linux -- Python 3.11.3, pytest-7.4.0, pluggy-1.2.0
rootdir: /home/ben/src/multiecho
collected 1 item                                                               

tests/test_load_me_data.py F                                             [100%]

=================================== FAILURES ===================================
_________________________ MyUnitTest.test_load_me_data _________________________

self = <tests.test_load_me_data.MyUnitTest testMethod=test_load_me_data>

    def test_load_me_data(self):
>       with patch('multiecho.combination.logger') as log_mock:

tests/test_load_me_data.py:8: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.11/unittest/mock.py:1437: in __enter__
    original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <unittest.mock._patch object at 0x7f2373b00290>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <module 'multiecho.combination' from '/home/ben/src/multiecho/multiecho/combination.py'> does not have the attribute 'logger'

/usr/lib64/python3.11/unittest/mock.py:1410: AttributeError
=========================== short test summary info ============================
FAILED tests/test_load_me_data.py::MyUnitTest::test_load_me_data - AttributeError: <module 'multiecho.combination' from '/home/ben/src/multiec...
============================== 1 failed in 0.24s ===============================

(Using an older Python version such as 3.9 or 3.6 does not make a difference.)

Perhaps this test is just a placeholder, and not intended to be usable?

@marcelzwiers
Copy link
Collaborator

marcelzwiers commented Jul 2, 2023

I think @dangom had started to set up the unit tests, using a placeholder indeed, but never got to implement the intended tests. I am not using unittest myself (I prefer pytest), so I am leaving this issue open for anyone to fix (sorry)

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

No branches or pull requests

3 participants