Skip to content
This repository was archived by the owner on May 27, 2024. It is now read-only.
This repository was archived by the owner on May 27, 2024. It is now read-only.

INTERNALERROR> AttributeError: 'XshFunction' object has no attribute 'get_marker' #20

@andry81

Description

@andry81

As suggested here:
https://stackoverflow.com/questions/54254337/pytest-attributeerror-function-object-has-no-attribute-get-marker/54254338#54254338

See pytest-dev/pytest#4564

Remove Node.get_marker(name) the return value was not usable for more than a existence check.

Use Node.get_closest_marker(name) as a replacement.

Remove testfunction.markername attributes - use Node.iter_markers(name=None) to iterate them.

I've tried to patch but it raise another error:

c:\python\x86\38\lib\site-packages\_pytest\mark\structures.py:321: PytestUnknownMarkWarning: Unknown pytest.mark.mp_group_info - is this a typo?  You can register custom marks to a
void this warning - for details, see https://docs.pytest.org/en/latest/mark.html
  warnings.warn(
There should be 17 tests run.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\python\x86\38\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "c:\python\x86\38\lib\multiprocessing\spawn.py", line 126, in _main
    self = reduction.pickle.load(from_parent)
ModuleNotFoundError: No module named 'pytest_mp'

I've using this marker as introduced in an example:

@pytest.mark.mp_group('proc_isolated', 'free')
def test_foo():
  ...

I am using the xonsh module and tests in files with .xsh registered extension.

I need a per test isolated processes to avoid globals data merge.
Could it be fixed?

Update:
I've found the partial answer: #19

I did rewrite the installed pytest-mp module by sources from the master branch of the github but got hit with another error output:

collected 17 items
c:\python\x86\38\lib\site-packages\_pytest\mark\structures.py:321: PytestUnknownMarkWarning: Unknown pytest.mark.mp_group_info - is this a typo?  You can register custom marks to a
void this warning - for details, see https://docs.pytest.org/en/latest/mark.html
  warnings.warn(
There should be 17 tests run.
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\_pytest\main.py", line 193, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\_pytest\main.py", line 237, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\pluggy\manager.py", line 92, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\pluggy\manager.py", line 83, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\pytest_mp\plugin.py", line 358, in pytest_runtestloop
INTERNALERROR>     run_batched_tests(batches, session, num_processes)
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\pytest_mp\plugin.py", line 272, in run_batched_tests
INTERNALERROR>     submit_test_to_process(test, session)
INTERNALERROR>   File "c:\python\x86\38\lib\site-packages\pytest_mp\plugin.py", line 204, in submit_test_to_process
INTERNALERROR>     proc.start()
INTERNALERROR>   File "c:\python\x86\38\lib\multiprocessing\process.py", line 121, in start
INTERNALERROR>     self._popen = self._Popen(self)
INTERNALERROR>   File "c:\python\x86\38\lib\multiprocessing\context.py", line 224, in _Popen
INTERNALERROR>     return _default_context.get_context().Process._Popen(process_obj)
INTERNALERROR>   File "c:\python\x86\38\lib\multiprocessing\context.py", line 326, in _Popen
INTERNALERROR>     return Popen(process_obj)
INTERNALERROR>   File "c:\python\x86\38\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__
INTERNALERROR>     reduction.dump(process_obj, to_child)
INTERNALERROR>   File "c:\python\x86\38\lib\multiprocessing\reduction.py", line 60, in dump
INTERNALERROR>     ForkingPickler(file, protocol).dump(obj)
INTERNALERROR> AttributeError: Can't pickle local object 'ArgumentParser.__init__.<locals>.identity'

============================================================================== no tests ran in 0.54s ==============================================================================
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\python\x86\38\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "c:\python\x86\38\lib\multiprocessing\spawn.py", line 126, in _main
    self = reduction.pickle.load(from_parent)
EOFError: Ran out of input
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\python\x86\38\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "c:\python\x86\38\lib\multiprocessing\spawn.py", line 126, in _main
    self = reduction.pickle.load(from_parent)
ModuleNotFoundError: No module named 'pytest_mp'

Update2:
I did downgrade from python x86 3.8.0 to python x86 3.5.3 and found that the error output is slightly different:

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "c:\python\x86\35\lib\site-packages\_pytest\main.py", line 193, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
...
INTERNALERROR>   File "c:\python\x86\35\lib\multiprocessing\popen_spawn_win32.py", line 66, in __init__
INTERNALERROR>     reduction.dump(process_obj, to_child)
INTERNALERROR>   File "c:\python\x86\35\lib\multiprocessing\reduction.py", line 59, in dump
INTERNALERROR>     ForkingPickler(file, protocol).dump(obj)
INTERNALERROR> _pickle.PicklingError: Can't pickle <class 'module'>: attribute lookup module on builtins failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions