[PATCH v2] tests: fix assertion rewriting in some tests with pytest-3.0.0+
Mads Kiilerich
mads at kiilerich.com
Mon Sep 12 19:38:49 UTC 2016
On 09/12/2016 09:29 PM, Thomas De Schampheleire wrote:
>
>> It seems like also here, the problem is that we do too much in __init__.py .
>> Perhaps this initialization (with slight modifications) should be in
>> kallithea/tests/__init__.py, but TestController and helper functions should
>> first move to something like kallithea/tests/base.py .
>>
> Perhaps so, but even then with
> 'register_assert_rewrite('kallithea.tests') from
> kallithea/tests/__init__.py, the warning would pop up. I haven't tried
> to add a trailing dot there, to indicate all submodules. Is that valid
> python syntax?
I don't know what the function accepts - they could allow more than
exactly Python. But I guess the register function also can be used to
specify several paths - perhaps by calling it multiple times?
It still seems to me like having it in pytest.ini would be cleaner and
solve this problem ... if possible. I assume it pytest will rewrite
asserts in 'python_files = kallithea/tests/**/test_*.py', so the problem
could be solved by putting the base asserts in files matching that
pattern ... or adding another pattern that maches the helper file.
/Mads
More information about the kallithea-general
mailing list