Skip to content

Commit ecdf9b1

Browse files
joaquinvanschorenmfeurer
authored andcommitted
added documentation for running specific tests (#561)
* added documentation for running specific tests * added more info on running specific unit tests * minor fixes * Update contributing.rst
1 parent 2e69fe0 commit ecdf9b1

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

doc/contributing.rst

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ execute
9898
python setup.py install
9999
100100
Testing
101-
~~~~~~~
101+
=======
102102

103103
From within the directory of the cloned package, execute:
104104

@@ -108,6 +108,56 @@ From within the directory of the cloned package, execute:
108108
109109
.. _extending:
110110

111+
Executing a specific test can be done by specifying the module, test case, and test.
112+
To obtain a hierarchical list of all tests, run
113+
114+
.. code:: bash
115+
116+
pytest --collect-only
117+
118+
.. _extending:
119+
120+
.. code:: bash
121+
122+
<Module 'tests/test_datasets/test_dataset.py'>
123+
<UnitTestCase 'OpenMLDatasetTest'>
124+
<TestCaseFunction 'test_dataset_format_constructor'>
125+
<TestCaseFunction 'test_get_data'>
126+
<TestCaseFunction 'test_get_data_rowid_and_ignore_and_target'>
127+
<TestCaseFunction 'test_get_data_with_ignore_attributes'>
128+
<TestCaseFunction 'test_get_data_with_rowid'>
129+
<TestCaseFunction 'test_get_data_with_target'>
130+
<UnitTestCase 'OpenMLDatasetTestOnTestServer'>
131+
<TestCaseFunction 'test_tagging'>
132+
133+
.. _extending:
134+
135+
To run a specific module, add the module name, for instance:
136+
137+
.. code:: bash
138+
139+
pytest tests/test_datasets/test_dataset.py
140+
141+
.. _extending:
142+
143+
To run a specific unit test case, add the test case name, for instance:
144+
145+
.. code:: bash
146+
147+
pytest tests/test_datasets/test_dataset.py::OpenMLDatasetTest
148+
149+
.. _extending:
150+
151+
To run a specific unit test, add the test name, for instance:
152+
153+
.. code:: bash
154+
155+
pytest tests/test_datasets/test_dataset.py::OpenMLDatasetTest::test_get_data
156+
157+
.. _extending:
158+
159+
Happy testing!
160+
111161
Connecting new machine learning libraries
112162
=========================================
113163

0 commit comments

Comments
 (0)