pytest icon indicating copy to clipboard operation
pytest copied to clipboard

_parse_parametrize_args() missing 2 required positional arguments: 'argnames' and 'argvalues'

Open jramosss opened this issue 3 years ago • 1 comments

  • [X] a detailed description of the bug or problem you are having I wrote a simple test
@pytest.mark.parametrize("dict1, dict2, expected_dict", [
    ({}, {}, {}),
    ({}, {"a": 1}, {"a": 1}),
    ({"a": 1}, {}, {"a": 1}),
    ({"a": 1}, {"a": 2}, {"a": [1, 2]}),
    ({"a": [1, 2]}, {"a": [3, 4]}, {"a": [1, 2, 3, 4]}),
    ({"a": [1, 2]}, {"b": [3, 4]}, {"a": [1, 2], "b": [3, 4]})
])
def test_merge_dict(dict1, dict2, expected_dict):
    assert merge_dictionary(dict1, dict2) == expected_dict

when i run pytest , i get the following traceback:

(.venv) ➜  workspaces git:(cron-refactor) pytest resources/workflows/crons/workflow_activations/tests/test_utils.py 
Test session starts (platform: linux, Python 3.8.13, pytest 7.1.2, pytest-sugar 0.9.5)
Django settings: service.settings.local (from environment variable)
rootdir: /home/shuls/Documents/seenka/repos/workspaces, configfile: pytest.ini
plugins: mock-3.8.2, cov-3.0.0, Faker-12.0.1, requests-mock-1.9.3, sugar-0.9.5, lazy-fixture-0.6.3, django-3.6.0
collecting ... 
―――――――――― ERROR collecting resources/workflows/crons/workflow_activations/tests/test_utils.py ――――――――――
.venv/lib/python3.8/site-packages/_pytest/nodes.py:140: in _create
    return super().__call__(*k, **kw)
.venv/lib/python3.8/site-packages/_pytest/python.py:1724: in __init__
    fixtureinfo = self.session._fixturemanager.getfixtureinfo(
.venv/lib/python3.8/site-packages/_pytest/fixtures.py:1435: in getfixtureinfo
    initialnames, node, ignore_args=self._get_direct_parametrize_args(node)
.venv/lib/python3.8/site-packages/_pytest/fixtures.py:1414: in _get_direct_parametrize_args
    p_argnames, _ = ParameterSet._parse_parametrize_args(
E   TypeError: _parse_parametrize_args() missing 2 required positional arguments: 'argnames' and 'argvalues'

During handling of the above exception, another exception occurred:
.venv/lib/python3.8/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
.venv/lib/python3.8/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.venv/lib/python3.8/site-packages/_pytest/python.py:262: in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
.venv/lib/python3.8/site-packages/_pytest/python.py:471: in _genfunctions
    definition = FunctionDefinition.from_parent(self, name=name, callobj=funcobj)
.venv/lib/python3.8/site-packages/_pytest/python.py:1734: in from_parent
    return super().from_parent(parent=parent, **kw)
.venv/lib/python3.8/site-packages/_pytest/nodes.py:264: in from_parent
    return cls._create(parent=parent, **kw)
.venv/lib/python3.8/site-packages/_pytest/nodes.py:155: in _create
    return super().__call__(*k, **known_kw)
.venv/lib/python3.8/site-packages/_pytest/python.py:1724: in __init__
    fixtureinfo = self.session._fixturemanager.getfixtureinfo(
.venv/lib/python3.8/site-packages/_pytest/fixtures.py:1435: in getfixtureinfo
    initialnames, node, ignore_args=self._get_direct_parametrize_args(node)
.venv/lib/python3.8/site-packages/_pytest/fixtures.py:1414: in _get_direct_parametrize_args
    p_argnames, _ = ParameterSet._parse_parametrize_args(
E   TypeError: _parse_parametrize_args() missing 2 required positional arguments: 'argnames' and 'argvalues'

======================================== short test summary info ========================================
FAILED resources/workflows/crons/workflow_activations/tests/test_utils.py - TypeError: _parse_parametr...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Results (0.52s):
  • [X] output of pip list from the virtual environment you are using
Package                           Version    Editable project location
--------------------------------- ---------- --------------------------------------------------------------------------------------
aiohttp                           3.8.1
aiosignal                         1.2.0
appdirs                           1.4.4
argcomplete                       1.12.3
asgiref                           3.5.2
asttokens                         2.0.8
async-timeout                     4.0.2
attrs                             22.1.0
backcall                          0.2.0
backports.zoneinfo                0.2.1
bcrypt                            4.0.0
better-admin                      1.0        /home/shuls/Documents/seenka/repos/workspaces/.venv/src/better-admin/libs/better_admin
bigquery                          0.0.22
black                             22.6.0
cachetools                        4.2.4
certifi                           2022.6.15
cffi                              1.15.1
chardet                           3.0.4
charset-normalizer                2.1.1
click                             8.1.3
colorlog                          4.8.0
coverage                          6.4.4
cryptography                      37.0.4
curlify                           2.2.1
dacktool                          0.0.7
dbstream                          0.1.11
decorator                         5.1.1
defusedxml                        0.7.1
dictdiffer                        0.9.0
diff-match-patch                  20200713
distlib                           0.3.5
Django                            3.1.7
django-admin-list-filter-dropdown 1.0.3
django-admin-rangefilter          0.8.7
django-admin-shortcuts            2.0.0
django-autocompletefilter         0.0.8
django-cas-ng                     4.3.0
django-cors-headers               3.11.0
django-coverage-plugin            2.0.3
django-elasticsearch-dsl          7.1.4
django-environ                    0.4.5
django-extensions                 2.2.5
django-filter                     2.4.0
django-import-export              2.7.1
django-logentry-admin             1.0.5      /home/shuls/Documents/seenka/repos/workspaces/.venv/src/django-logentry-admin
django-prometheus                 2.2.0
django-redis                      4.10.0
django-smtp-ssl                   1.0
django-storages                   1.7.2
django-timezone-field             5.0
django-username-email             2.5.3
djangorestframework               3.12.4
djangorestframework-api-key       2.0.0
djangorestframework-simplejwt     4.3.0
docopt                            0.6.2
elasticsearch                     7.1.0
elasticsearch-dsl                 7.1.0
et-xmlfile                        1.1.0
executing                         0.10.0
facebook-business                 9.0.0
Faker                             12.0.1
filelock                          3.8.0
frozenlist                        1.3.1
google-ads                        11.0.2
google-api-core                   1.23.0
google-api-python-client          1.12.8
google-auth                       1.23.0
google-auth-httplib2              0.0.4
google-auth-oauthlib              0.4.2
google-cloud-bigquery             2.18.0
google-cloud-bigquery-storage     2.5.0
google-cloud-core                 1.5.0
google-cloud-pubsub               2.2.0
google-cloud-storage              1.40.0
google-crc32c                     1.3.0
google-resumable-media            1.3.3
googleapis-common-protos          1.52.0
googleauthentication              0.0.15
grpc-google-iam-v1                0.12.3
grpcio                            1.47.0
gunicorn                          19.9.0
httplib2                          0.20.4
idna                              2.8
inflect                           6.0.0
iniconfig                         1.1.1
ipdb                              0.12.2
ipython                           8.4.0
jedi                              0.18.1
libcst                            0.4.7
libretranslatepy                  2.1.1
lxml                              4.9.1
MarkupPy                          1.14
MarkupSafe                        2.1.1
matplotlib-inline                 0.1.6
mixer                             7.2.2
multidict                         6.0.2
mypy                              0.740
mypy-extensions                   0.4.3
nox                               2020.12.31
numpy                             1.23.2
oauth2client                      4.1.3
oauthlib                          3.2.0
odfpy                             1.4.1
openpyxl                          3.0.10
packaging                         21.3
pandas                            1.3.5
paramiko                          2.11.0
parso                             0.8.3
pathspec                          0.9.0
pep562                            1.1
pexpect                           4.8.0
phonenumbers                      8.12.54
pickleshare                       0.7.5
Pillow                            9.2.0
pip                               22.0.4
places                            1.1        /home/shuls/Documents/seenka/repos/workspaces/.venv/src/places/libs/places
platformdirs                      2.5.2
pluggy                            1.0.0
prometheus-client                 0.14.1
prompt-toolkit                    3.0.30
proto-plus                        1.22.0
protobuf                          3.20.1
psycopg2-binary                   2.9.3
ptyprocess                        0.7.0
pure-eval                         0.2.2
py                                1.11.0
pyarrow                           9.0.0
pyasn1                            0.4.8
pyasn1-modules                    0.2.8
pycodestyle                       2.9.1
pycountry                         22.3.5
pycparser                         2.21
pydantic                          1.9.2
Pygments                          2.13.0
PyJWT                             2.4.0
pykwalify                         1.7.0
PyNaCl                            1.5.0
pyparsing                         3.0.9
pypelines                         0.2        /home/shuls/Documents/seenka/repos/workspaces/.venv/src/pypelines
pytest                            7.1.2
pytest-cov                        3.0.0
pytest-django                     3.6.0
pytest-lazy-fixture               0.6.3
pytest-mock                       3.8.2
pytest-sugar                      0.9.5
python-cas                        1.6.0
python-dateutil                   2.8.2
python-slugify                    4.0.0
pytz                              2019.3
PyYAML                            5.4.1
redis                             3.3.11
requests                          2.22.0
requests-mock                     1.9.3
requests-oauthlib                 1.3.1
rsa                               4.9
sentry-sdk                        1.9.0
setuptools                        56.0.0
six                               1.16.0
sqlparse                          0.4.2
sshtunnel                         0.1.5
stack-data                        0.4.0
stripe                            4.1.0
tablib                            3.2.1
tags                              1.0        /home/shuls/Documents/seenka/repos/workspaces/.venv/src/tags/libs/tags
tblib                             1.7.0
termcolor                         1.1.0
text-unidecode                    1.3
toml                              0.10.2
tomli                             2.0.1
traitlets                         5.3.0
translate                         3.6.1
twilio                            7.12.1
typed-ast                         1.4.3
typing_extensions                 4.3.0
typing-inspect                    0.8.0
uritemplate                       3.0.1
urllib3                           1.25.11
users                             1.0        /home/shuls/Documents/seenka/repos/workspaces/.venv/src/users/libs/users
uuid                              1.30
validators                        0.20.0
virtualenv                        20.16.3
wcwidth                           0.2.5
Werkzeug                          2.2.2
xlrd                              2.0.1
xlwt                              1.3.0
yarl                              1.8.1
  • [X] pytest and operating system versions pytest 7.1.2 ubuntu 22.04

jramosss avatar Sep 08 '22 19:09 jramosss

This didn't reproduce in my environment, so I suspect that someone is monkeypatching something. (although I did have to modify your example to get it running - making it both complete and minimal is always helpful) Can you try narrowing down to the smallest set of extra libraries that reproduces the error?

Zac-HD avatar Sep 13 '22 06:09 Zac-HD

Closing because we don't have the needed information to resolve this, happy to reopen if that changes 😕

Zac-HD avatar Sep 27 '22 05:09 Zac-HD