parameterized icon indicating copy to clipboard operation
parameterized copied to clipboard

error when testing in parallel with nose2

Open dcatteeu opened this issue 5 years ago • 1 comments
trafficstars

Nose2 throws following errors when running parameterized tests in parallel with nose2.

ERROR: test_not_found (nose2.loader.LoadTestsFailure)
Traceback (most recent call last):
  File "[...cut...]/site-packages/parameterized/parameterized.py", line 518, in standalone_func
    return func(*(a + p.args), **p.kwargs)
TypeError: test_get_key() missing 1 required positional argument: 'expected'

The code in case is this:

class TestFilter(unittest.TestCase):

    @parameterized.expand([
        [{'val': 1}, 1, 1],
        [{'val': 1.0}, 1, 1],
        [{'val': 1.1}, 1, 1.1],
        [{'val': 0}, 1, 0],
        [{'val': 0.0}, 1, 0]
    ])
    def test_get_key(self, event, operand, expected):
        self.assertEqual(expected, Operations.get_key(event, 'val', operand))

I run tests with (my_conda_env) $ nose2 and have the following unittest.cfg:

[unittest]
plugins = nose2.plugins.mp

[multiprocess]
always-on = True
processes = 4

The following scenarios just works:

  • same thing but without parameterized tests
  • same thing but disable nose2's multiprocess feature

Related packages in my_conda_env:

nose2                     0.9.1                      py_0    conda-forge
parameterized             0.7.1                      py_0    conda-forge
python                    3.6.7             h4285619_1006    conda-forge

dcatteeu avatar Jan 08 '20 09:01 dcatteeu

Oof good catch. I don't have the cycles to write a fix right now, but would be very happy to review a PR!

wolever avatar Apr 12 '20 21:04 wolever