Add --func and --long as short options to py.test.
AbandonedPublic

Authored by ralph on Mar 31 2014, 4:28 PM.

Details

Summary

This is for T89

Test Plan
Try running:

    py.test testing/
    py.test testing/ --func
    py.test testing/ --long
    py.test testing/ --func --long --functional

Are the expected test suites run?

Diff Detail

Branch
feature/short-opts
Lint
No Linters Available
Unit
No Unit Test Coverage
kparal added a comment.Apr 1 2014, 8:42 AM

It works. But do we really need three synonyms? :-)

I've found out that short lowecase options are reserved, but we can use uppercase ones. What about this (patch against develop)?

diff --git a/testing/conftest.py b/testing/conftest.py
index c49cac5..4bbbd20 100644
--- a/testing/conftest.py
+++ b/testing/conftest.py
@@ -30,7 +30,7 @@ def pytest_addoption(parser):
     should be detected and run
     """
 
-    parser.addoption('--functional', action='store_true', default=False,
+    parser.addoption('-F', '--functional', action='store_true', default=False,
                      help='Add functional tests')

Seems to work just fine:

$ py.test -F testing/
[libtaskotron:logger.py:63] 2014-04-01 10:40:10 DEBUG   doing stream logging
=========================================================== test session starts ============================================================
platform linux2 -- Python 2.7.5 -- py-1.4.20 -- pytest-2.5.2
plugins: cov
collected 79 items / 1 skipped 

testing/functest_python_directive.py ...
testing/test_bodhi_directive.py .......
testing/test_bodhi_utils.py ..
testing/test_check.py .....................
testing/test_koji_directive.py ..
testing/test_koji_utils.py ...
testing/test_python_directive.py ........
testing/test_python_utils.py ..
testing/test_runner.py ........................
testing/test_taskyaml.py .......

=================================================== 79 passed, 1 skipped in 0.42 seconds ===================================================

+1 for the "-F" solution.

ralph abandoned this revision.Apr 1 2014, 1:40 PM

Yeah, "-F" is much better.

@ralph, I assumed you would send an adjusted patch, but since you didn't, I've posted D39.