-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
TypeError in python.py:_getobj when having a TestCase namedtuple #1579
Comments
please test with version 2.9.2, it has a fix for #510 which could be related - else i#ll have to investigate deeper, |
Same thing with 2.9.2. This also happens when building the cartesian product for multiple parameters: @pytest.mark.parametrize(
'test_cases',
[[],
[TestCase('dummy', '453123', pd.DataFrame({'test': [1]}))]])
@pytest.mark.parametrize(
'counters_by_component',
[{},
{'test': pd.DataFrame({'ffoo': [4]})}])
@pytest.mark.parametrize('test_time', [pd.to_datetime('now')])
def test_read_write_roundtrip(tmpdir, test_cases, counters_by_component,
test_time):
pass Results in the same exception once the respective parameter combination is reached. |
And another case: @pytest.mark.parametrize('foo', [None])
def test_read_write_roundtrip(foo):
pass |
FWIW I can't reproduce either of the minimal examples with Python 2.7.11 and pytest 2.9.2. |
So maybe it is miniconda-related? |
I'd doubt it, but maybe I'm wrong 😉 Can you run with |
Ok, I found what is causing this in my test file: from perfmonvalidation.data import (TestCase) |
I can import that with a different name, but can't the name clash be avoided? |
|
Okay, so it has nothing to do with pytest will try to collect tests in all classes starting with |
its a namedtuple |
Reproduced with this import collections
TestCase = collections.namedtuple('TestCase', ['a']) Renaming the issue to avoid confusion. |
parametrizing a test function fails in case the argument for the function is only an empty list:
fails with:
Running on ubuntu trusty 64 bit with miniconda python:
The text was updated successfully, but these errors were encountered: