Skip to content

Commit a3efb5b

Browse files
Poruri Sai Rahulmdickinson
Poruri Sai Rahul
authored andcommitted
Reveal and fix a masked test (#1671)
* DEV: Reveal a masked test method the test method started with an underscore which is why unittest wasnt discovering it modified: traits/etsconfig/tests/test_etsconfig.py * FIX: Update the app_name and get the test passing we are making a strong assumption here that the tests are being run using unittest modified: traits/etsconfig/tests/test_etsconfig.py * CLN: Remove the now unnecessary dundername/dundermain clause modified: traits/etsconfig/tests/test_etsconfig.py (cherry picked from commit f379908)
1 parent 065da52 commit a3efb5b

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

traits/etsconfig/tests/test_etsconfig.py

+5-17
Original file line numberDiff line numberDiff line change
@@ -202,20 +202,19 @@ def test_set_company(self):
202202
self.ETSConfig.company = old
203203
self.assertEqual(old, self.ETSConfig.company)
204204

205-
def _test_default_application_home(self):
205+
def test_default_application_home(self):
206206
"""
207207
application home
208208
209209
"""
210-
211-
# This test is only valid when run with the 'main' at the end of this
212-
# file: "python app_dat_locator_test_case.py", in which case the
213-
# app_name will be the directory this file is in ('tests').
214210
app_home = self.ETSConfig.application_home
215211
(dirname, app_name) = os.path.split(app_home)
216212

217213
self.assertEqual(dirname, self.ETSConfig.application_data)
218-
self.assertEqual(app_name, "tests")
214+
215+
# The assumption here is that the test was run using unittest and not
216+
# a different test runner e.g. using "python -m unittest ...".
217+
self.assertEqual(app_name, "unittest")
219218

220219
def test_toolkit_default_kiva_backend(self):
221220
self.ETSConfig.toolkit = "qt4"
@@ -363,14 +362,3 @@ def test_write_to_user_data_directory(self):
363362
os.remove(path)
364363

365364
self.assertEqual(data, result)
366-
367-
368-
# For running as an individual set of tests.
369-
if __name__ == "__main__":
370-
371-
# Add the non-default test of application_home...non-default because it
372-
# must be run using this module as a script to be valid.
373-
suite = unittest.TestLoader().loadTestsFromTestCase(ETSConfigTestCase)
374-
suite.addTest(ETSConfigTestCase("_test_default_application_home"))
375-
376-
unittest.TextTestRunner(verbosity=2).run(suite)

0 commit comments

Comments
 (0)