[PATCH 1 of 2 v2] tests: move pytest settings from kallithea/tests/pytest.ini to setup.cfg

Thomas De Schampheleire patrickdepinguin at gmail.com
Sat May 16 16:50:59 EDT 2015


On Sat, May 16, 2015 at 12:50 AM, Mads Kiilerich <mads at kiilerich.com> wrote:
> On 05/14/2015 09:47 PM, Thomas De Schampheleire wrote:
>>
>> # HG changeset patch
>> # User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
>> # Date 1431630347 -7200
>> #      Thu May 14 21:05:47 2015 +0200
>> # Node ID 6a7b32b3fdc09d515dc68c347b60e9d8d07a1a5e
>> # Parent  1446e9c945e802ed9288a9e091343d6a2bb02e9b
>> tests: move pytest settings from kallithea/tests/pytest.ini to setup.cfg
>>
>> pytest only uses one configuration file and does not merge settings from
>> multiple files [1]. The first detected file is setup.cfg thus should
>> contain
>> all relevant configuration.
>>
>> [1]
>> http://pytest.org/latest/customize.html#initialization-determining-rootdir-and-inifile
>>
>> diff --git a/kallithea/tests/pytest.ini b/kallithea/tests/pytest.ini
>> deleted file mode 100644
>> --- a/kallithea/tests/pytest.ini
>> +++ /dev/null
>> @@ -1,7 +0,0 @@
>> -[pytest]
>> -addopts =
>> -    # --verbose
>> -    # show extra test summary info as specified by chars (f)ailed,
>> (E)error, (s)skipped, (x)failed, (X)passed, (w)warnings.
>> -    -rfEsxXw
>> -    # Shorter scrollbacks; less stuff to scroll through
>> -    --tb=short
>> diff --git a/setup.cfg b/setup.cfg
>> --- a/setup.cfg
>> +++ b/setup.cfg
>> @@ -13,6 +13,12 @@ nologcapture = 1
>>   [pytest]
>>   # only look for tests in kallithea/tests
>>   python_files = kallithea/tests/**/test_*.py
>> +addopts =
>> +    # --verbose
>> +    # show extra test summary info as specified by chars (f)ailed,
>> (E)error, (s)skipped, (x)failed, (X)passed, (w)warnings.
>> +    -rfEsxXw
>> +    # Shorter scrollbacks; less stuff to scroll through
>> +    --tb=short
>>     [compile_catalog]
>>   domain = kallithea
>
>
> With this, I get:
>
> =============================================================================================
> short test summary info
> =============================================================================================
> SKIP [1]
> /home/madski/kallithea-venv/lib/python2.7/site-packages/_pytest/unittest.py:114:
> not implemented
> SKIP [1]
> /home/madski/kallithea-venv/lib/python2.7/site-packages/_pytest/unittest.py:114:
> skipped due to existing index
>
> ====================================================================================
> 1594 passed, 2 skipped in 189.09 seconds
> =====================================================================================
>
> Is this expected?
>
> The messages are ok but the file and line numbers are not helpful.

I'm not sure how you triggered the skips, but when I forcibly fail a
test, I get output like this:

=====================================================================================
test session starts
======================================================================================
platform linux2 -- Python 2.7.5 -- py-1.4.26 -- pytest-2.7.0
rootdir: /home/tdescham/repo/contrib/kallithea-typos, inifile: setup.cfg
collected 22 items

kallithea/tests/models/test_changeset_status.py .........F............

===========================================================================================
FAILURES ===========================================================================================
__________________________________________________________________
TestChangesetStatusCalculation.test_result_17_reject_none
___________________________________________________________________
kallithea/tests/parameterized.py:111: in parameterized_expand_helper_helper
    return func(*(self + args))
kallithea/tests/models/test_changeset_status.py:42: in test_result
    self.assertEqual(True, False)
E   AssertionError: True != False
===================================================================================
short test summary info
====================================================================================
FAIL kallithea/tests/models/test_changeset_status.py::TestChangesetStatusCalculation::test_result_17_reject_none
=============================================================================
1 failed, 21 passed in 0.12 seconds
==============================================================================


So what is shown is the file + class + method, which is reasonable and correct.
The line number is shown in the failure itself.

Thomas


More information about the kallithea-general mailing list