Skip to content

Commit d7db400

Browse files
committed
./run_tests.py automatically add tmuxp.testsuite to testmodule names
1 parent b0b6dd7 commit d7db400

File tree

3 files changed

+42
-13
lines changed

3 files changed

+42
-13
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Here you can find the recent changes to tmuxp.
1111
- [internal] `pep257`_ fixes.
1212
- [internal] [tests] - :class:`Pane` now has :meth:`Pane.set_width` and
1313
:meth:`Pane.set_height`.
14+
- [tests] ``./run_tests.py --tests`` now automatically prepends
15+
``tmuxp.testsuite`` to names.
1416

1517
2013-10-27
1618
----------

doc/developing.rst

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,22 @@ If you found a problem or are trying to write a test, you can file an
7474
Choose tests to run
7575
"""""""""""""""""""
7676

77-
Testing specific testsuites, testcase and tests
77+
.. note::
78+
79+
As of v0.0.20, ``--tests`` automatically assume the namespace of
80+
``tmuxp.testsuite``.
81+
82+
.. code-block:: bash
83+
84+
$ ./run_tests.py --tests test_config.ImportExportTest
85+
86+
Is now equivalent to:
87+
88+
.. code-block:: bash
89+
90+
$ ./run_tests.py --tests tmuxp.testsuite.test_config.ImportExportTest
91+
92+
Testing specific TestSuites, TestCase and tests
7893

7994
.. code-block:: bash
8095
@@ -87,26 +102,26 @@ By :py:class:`unittest.TestSuite` / module:
87102

88103
.. code-block:: bash
89104
90-
$ ./run_tests.py tmuxp.testsuite.test_config
105+
$ ./run_tests.py test_config
91106
92107
by :py:class:`unittest.TestCase`:
93108

94109
.. code-block:: bash
95110
96-
$ ./run_tests.py --tests tmuxp.testsuite.test_config.ImportExportTest
111+
$ ./run_tests.py --tests test_config.ImportExportTest
97112
98113
individual tests:
99114

100115
.. code-block:: bash
101116
102-
$ ./run_tests.py --tests tmuxp.testsuite.test_config.ImportExportTest.test_export_json
117+
$ ./run_tests.py --tests test_config.ImportExportTest.test_export_json
103118
104119
Multiple can be separated by spaces:
105120

106121
.. code-block:: bash
107122
108-
$ ./run_tests.py --tests tmuxp.testsuite.test_config.ImportExportTest.test_export_json \
109-
testsuite.test_config.ImportExportTest.test_window
123+
$ ./run_tests.py --tests ImportExportTest.test_export_json \
124+
ImportExportTest.test_window
110125
111126
.. _test_builder_visually:
112127

@@ -237,9 +252,9 @@ In this, I will also begin documenting the API.
237252
the use of:
238253

239254
Session
240-
Session.new_window() - returns a new Window object bound to the session,
255+
:meth:`Session.new_window()` - returns a new Window object bound to the session,
241256
also uses ``tmux new-window``.
242-
Session.new_session() - class method - returns a new Session object.
257+
:meth:`Session.new_session()` - class method - returns a new Session object.
243258

244259
Differences from tmux
245260
---------------------

run_tests.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,24 @@ def output(line):
131131
Test individual, TestCase or TestSuites, or multiple. Example for test_config TestSuite:
132132
133133
by TestSuite (module):
134-
$ ./run_tests.py tmuxp.testsuite.test_config
134+
$ ./run_tests.py test_config
135135
136136
by TestCase:
137-
$ ./run_tests.py tmuxp.testsuite.test_config.ImportExportTest
137+
$ ./run_tests.py test_config.ImportExportTest
138138
individual tests:
139-
$ ./run_tests.py tmuxp.testsuite.test_config.ImportExportTest.test_export_json
139+
$ ./run_tests.py test_config.ImportExportTest.test_export_json
140140
141141
Multiple can be separated by spaces:
142-
$ ./run_tests.py tmuxp.testsuite.test_config.ImportExportTest.test_export_json \\
143-
testsuite.test_config.ImportExportTest.test_window
142+
$ ./run_tests.py test_config.ImportExportTest.test_export_json \\
143+
test_config.ImportExportTest.test_window
144+
145+
./run_tests will automatically assume the package namespace ``tmuxp.testsuite``.
146+
147+
$ ./run_tests.py test_config.ImportExportTest
148+
149+
is the same as:
150+
151+
$ ./run_tests.py tmuxp.testsuite.test_config.ImportExportTest
144152
'''
145153
)
146154
parser.add_argument('-l', '--log-level', dest='log_level', default='INFO',
@@ -171,6 +179,10 @@ def output(line):
171179
else:
172180
sys.exit(1)
173181
if args.tests and len(args.tests) > int(0):
182+
for arg in args.tests:
183+
if not arg.startswith('tmuxp.testsuite'):
184+
loc = args.tests.index(arg)
185+
args.tests[loc] = 'tmuxp.testsuite.%s' % arg
174186
suites = unittest.TestLoader().loadTestsFromNames(args.tests)
175187
result = unittest.TextTestRunner(verbosity=verbosity, failfast=args.failfast).run(suites)
176188
else:

0 commit comments

Comments
 (0)