Skip to content

Multiprocess plugins incompatible with mocks or docktests? #444

Open
@FurcyPin

Description

@FurcyPin

Hi,

I have a python projects that uses doctest for some tests and mocks for some other tests, and I use nose2 to run everything.

It works like a charm, but when I tried to enable the nose2.plugins.mp plugin for MultiProcess
testing I got error messages on all my tests that were using either doctest or mocks.

For test using mocks, I got errors that look like this:

======================================================================
ERROR: test_not_found (nose2.loader.LoadTestsFailure)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.6/unittest/mock.py", line 1179, in patched
    return func(*args, **keywargs)
TypeError: test_method() missing 1 required positional argument: 'mock_settings'

The test looks like this

    @mock.patch('dynaconf.settings.get', side_effect=test_settings)
    def test_method(self, mock_settings):
        "test something"

For test using doctest, I got errors that look like this:

======================================================================
ERROR: _my_function (some.Object)
Doctest: some.Object._my_function
----------------------------------------------------------------------
TypeError: _my_function() missing 3 required positional arguments: 'a', 'b', and 'c'

Where my doctest looks like this:

class Object():

    def _my_function(self, a, b, c):
        """

        Doctest:
        >>> Object()._my_function('a', 'b', 'c')
        hello

        :param a:
        :param b:
        :param c:
        :return:
        """
        print("hello")

If I disable the nose2.plugins.mp, everything works fine though.

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