Skip to content
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

-k option for tester should accept more than one keyword #5228

Closed
asmeurer opened this issue Dec 25, 2010 · 3 comments · Fixed by #8087
Closed

-k option for tester should accept more than one keyword #5228

asmeurer opened this issue Dec 25, 2010 · 3 comments · Fixed by #8087
Assignees
Labels
Enhancement imported Testing Related to the test runner. Do not use for test failures unless it relates to the test runner itself

Comments

@asmeurer
Copy link
Member

The -k option to the test runs only tests whose function names match the given keyword. It would be nice if you could supply it with more than one word, allowing you to run only a subset of tests from a file in one command. You can see from the first two commands below that it works fine for one word, but if more than one word is given, only the first one is used and subsequent ones are ignored.

Aaron-Meurer:sympy-scratch aaronmeurer20101224134130(master$%=)$./bin/test sympy/core/tests/test_basic.py -k structure -v
============================= test process starts ==============================
executable:   /sw/bin/python  (2.7.1-final-0)

sympy/core/tests/test_basic.py[1] 
test_structure ok                                                           [OK]


================== tests finished: 1 passed, in 0.02 seconds ===================
Aaron-Meurer:sympy-scratch aaronmeurer20101224134142(master$%=)$./bin/test sympy/core/tests/test_basic.py -k equality -v
============================= test process starts ==============================
executable:   /sw/bin/python  (2.7.1-final-0)

sympy/core/tests/test_basic.py[1] 
test_equality ok                                                            [OK]


================== tests finished: 1 passed, in 0.03 seconds ===================
Aaron-Meurer:sympy-scratch aaronmeurer20101224134155(master$%=)$./bin/test sympy/core/tests/test_basic.py -k structure equality -v
============================= test process starts ==============================
executable:   /sw/bin/python  (2.7.1-final-0)

sympy/core/tests/test_basic.py[1] 
test_structure ok                                                           [OK]


================== tests finished: 1 passed, in 0.10 seconds ===================

What I think is happening is that further arguments are accepted as further files.

Aaron-Meurer:sympy-scratch aaronmeurer20101224134626(master$%=)$./bin/test sympy/core/tests/test_arit.py -k issue numbers -v
============================= test process starts ==============================
executable:   /sw/bin/python  (2.7.1-final-0)

sympy/core/tests/test_arit.py[5] 
test_pow_issue417 ok
test_issue432 ok
test_issue432b ok
test_issue974 ok
test_issue415 ok                                                            [OK]

sympy/core/tests/test_numbers.py[6] 
test_issue222 ok
test_issue593 ok
test_issue324 ok
test_issue350 ok
test_issue1008 ok
test_issue1512 ok                                                           [OK]


================== tests finished: 11 passed, in 0.92 seconds ==================

But I think it would be more useful to make -k greedy so that it can allow more than one option (but not so greedy that it doesn't allow options like -v after it, though). Is the Python option parser advanced enough to let us do this?

Original issue for #5228: http://code.google.com/p/sympy/issues/detail?id=2129
Original author: https://code.google.com/u/asmeurer@gmail.com/
Original owner: https://code.google.com/u/asmeurer@gmail.com/

@asmeurer
Copy link
Member Author

At the very least this should work, although the greedy version would still be preferred.


Aaron-Meurer:sympy-scratch aaronmeurer20101224135511(master$%=)$./bin/test sympy/core/tests/test_basic.py -k structure -k equality -v
============================= test process starts ==============================
executable:   /sw/bin/python  (2.7.1-final-0)

sympy/core/tests/test_basic.py[1] 
test_equality ok                                                            [OK]


================== tests finished: 1 passed, in 0.14 seconds ===================

Original comment: http://code.google.com/p/sympy/issues/detail?id=2129#c1
Original author: https://code.google.com/u/asmeurer@gmail.com/

@asmeurer
Copy link
Member Author

asmeurer commented Jan 7, 2011

**Labels:** Testing  

Original comment: http://code.google.com/p/sympy/issues/detail?id=2129#c2
Original author: https://code.google.com/u/asmeurer@gmail.com/

@asmeurer
Copy link
Member Author

**Status:** Valid  

Original comment: http://code.google.com/p/sympy/issues/detail?id=2129#c3
Original author: https://code.google.com/u/asmeurer@gmail.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement imported Testing Related to the test runner. Do not use for test failures unless it relates to the test runner itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant