From d9a4aee6546b562d73e00ea8299ccbb44b6e4ee2 Mon Sep 17 00:00:00 2001 From: Matthew Morgan Date: Tue, 5 Sep 2017 07:06:36 -0400 Subject: [PATCH] Add annotation to skip all but first test --- exercises/isogram/isogram_test.py | 9 +++++++++ test/check-exercises.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/exercises/isogram/isogram_test.py b/exercises/isogram/isogram_test.py index 6573f898942..e49f14dc77e 100644 --- a/exercises/isogram/isogram_test.py +++ b/exercises/isogram/isogram_test.py @@ -10,30 +10,39 @@ class TestIsogram(unittest.TestCase): def test_empty_string(self): self.assertTrue(is_isogram("")) + @unittest.skip("remove this annotation to run this test") def test_isogram_with_only_lower_case_characters(self): self.assertTrue(is_isogram("isogram")) + @unittest.skip("remove this annotation to run this test") def test_word_with_one_duplicated_character(self): self.assertFalse(is_isogram("eleven")) + @unittest.skip("remove this annotation to run this test") def test_longest_reported_english_isogram(self): self.assertTrue(is_isogram("subdermatoglyphic")) + @unittest.skip("remove this annotation to run this test") def test_word_with_duplicated_character_in_mixed_case(self): self.assertFalse(is_isogram("Alphabet")) + @unittest.skip("remove this annotation to run this test") def test_hypothetical_isogrammic_word_with_hyphen(self): self.assertTrue(is_isogram("thumbscrew-japingly")) + @unittest.skip("remove this annotation to run this test") def test_isogram_with_duplicated_non_letter_character(self): self.assertTrue(is_isogram("Hjelmqvist-Gryb-Zock-Pfund-Wax")) + @unittest.skip("remove this annotation to run this test") def test_made_up_name_that_is_an_isogram(self): self.assertTrue(is_isogram("Emily Jung Schwartzkopf")) + @unittest.skip("remove this annotation to run this test") def test_duplicated_character_in_the_middle(self): self.assertFalse(is_isogram("accentor")) + @unittest.skip("remove this annotation to run this test") def test_isogram_with_duplicated_letter_and_nonletter_character(self): self.assertFalse(is_isogram("Aleph Bot Chap")) diff --git a/test/check-exercises.py b/test/check-exercises.py index 9a8c3a59b25..0f38a44ab0d 100755 --- a/test/check-exercises.py +++ b/test/check-exercises.py @@ -23,6 +23,7 @@ def check_assignment(name, test_file): try: test_file_out = os.path.join(workdir, os.path.basename(test_file)) shutil.copyfile(test_file, test_file_out) + unskip_tests(test_file_out) shutil.copyfile(os.path.join(os.path.dirname(test_file), 'example.py'), os.path.join(workdir, '{}.py'.format(example_name))) return subprocess.call([python_executable_name(), test_file_out]) @@ -30,6 +31,14 @@ def check_assignment(name, test_file): shutil.rmtree(workdir) +def unskip_tests(testfile): + with open(testfile) as f: + txt = f.read() + txt = txt.replace('@unittest.skip', '#@unittest.skip') + with open(testfile, 'w') as f: + f.write(txt) + + def modname_heuristic(test_file): with open(test_file) as f: tree = ast.parse(f.read(), filename=test_file)