Skip to content

Commit

Permalink
Merge f091fad into 05c8aaa
Browse files Browse the repository at this point in the history
  • Loading branch information
fornellas committed Jan 6, 2021
2 parents 05c8aaa + f091fad commit 9d89396
Show file tree
Hide file tree
Showing 2 changed files with 196 additions and 50 deletions.
50 changes: 23 additions & 27 deletions tests/cli_unittest.py
Expand Up @@ -159,7 +159,7 @@ def _process_output(fd, callback):
)

@staticmethod
def white(text):
def bright(text):
return "\x1b[0m\x1b[1m{}\x1b[0m".format(text)

@staticmethod
Expand Down Expand Up @@ -351,7 +351,7 @@ def test_colored_output_to_terminal(self):
tty_stdout=True,
expected_return_code=1,
expected_stdout_startswith=(
self.white("top context")
self.bright("top context")
+ "\r\n"
+ self.green(" passing example")
+ "\r\n"
Expand All @@ -363,7 +363,7 @@ def test_colored_output_to_terminal(self):
+ "\r\n"
+ self.yellow(" unittest SkipTest")
+ "\r\n"
+ self.white(" nested context")
+ self.bright(" nested context")
+ "\r\n"
+ self.green(" passing nested example")
+ "\r\n"
Expand All @@ -380,7 +380,7 @@ def test_colored_output_with_force_color(self):
self.run_testslide(
expected_return_code=1,
expected_stdout_startswith=(
self.white("top context")
self.bright("top context")
+ "\n"
+ self.green(" passing example")
+ "\n"
Expand All @@ -392,7 +392,7 @@ def test_colored_output_with_force_color(self):
+ "\n"
+ self.yellow(" unittest SkipTest")
+ "\n"
+ self.white(" nested context")
+ self.bright(" nested context")
+ "\n"
+ self.green(" passing nested example")
+ "\n"
Expand Down Expand Up @@ -464,7 +464,6 @@ def test_focus(self):
"top context\n"
" *focused example: PASS\n"
"\n"
"Finished 1 example(s) in "
# TODO add remaining bits of the output (using regexes)
)
)
Expand Down Expand Up @@ -524,7 +523,6 @@ def test_text_filter(self):
" nested context\n"
" passing nested example: PASS\n"
"\n"
"Finished 1 example(s) in "
),
)

Expand All @@ -541,7 +539,6 @@ def test_regexp_filter(self):
" nested context\n"
" passing nested example: PASS\n"
"\n"
"Finished 1 example(s) in "
),
)

Expand All @@ -565,7 +562,6 @@ def test_exclude_regexp(self):
" test_passing: PASS\n"
" test_skipped: SKIP\n"
"\n"
"Finished 7 example(s) in"
),
)

Expand Down Expand Up @@ -664,31 +660,31 @@ def test_colored_output_to_terminal(self):
tty_stdout=True,
expected_return_code=1,
expected_stdout_startswith=(
self.white("top context: ")
self.bright("top context: ")
+ self.green("passing example")
+ "\r\n"
+ self.white("top context: ")
+ self.bright("top context: ")
+ self.red("failing example: SimulatedFailure: test failure (extra)")
+ "\r\n"
+ self.white("top context: ")
+ self.bright("top context: ")
+ self.green("*focused example")
+ "\r\n"
+ self.white("top context: ")
+ self.bright("top context: ")
+ self.yellow("skipped example")
+ "\r\n"
+ self.white("top context: ")
+ self.bright("top context: ")
+ self.yellow("unittest SkipTest")
+ "\r\n"
+ self.white("top context, nested context: ")
+ self.bright("top context, nested context: ")
+ self.green("passing nested example")
+ "\r\n"
+ self.white("tests.sample_tests.SampleTestCase: ")
+ self.bright("tests.sample_tests.SampleTestCase: ")
+ self.red("test_failing: AssertionError: Third")
+ "\r\n"
+ self.white("tests.sample_tests.SampleTestCase: ")
+ self.bright("tests.sample_tests.SampleTestCase: ")
+ self.green("test_passing")
+ "\r\n"
+ self.white("tests.sample_tests.SampleTestCase: ")
+ self.bright("tests.sample_tests.SampleTestCase: ")
+ self.yellow("test_skipped")
+ "\r\n"
# TODO Rest of the output
Expand All @@ -704,31 +700,31 @@ def test_colored_output_with_force_color(self):
self.run_testslide(
expected_return_code=1,
expected_stdout_startswith=(
self.white("top context: ")
self.bright("top context: ")
+ self.green("passing example")
+ "\n"
+ self.white("top context: ")
+ self.bright("top context: ")
+ self.red("failing example: SimulatedFailure: test failure (extra)")
+ "\n"
+ self.white("top context: ")
+ self.bright("top context: ")
+ self.green("*focused example")
+ "\n"
+ self.white("top context: ")
+ self.bright("top context: ")
+ self.yellow("skipped example")
+ "\n"
+ self.white("top context: ")
+ self.bright("top context: ")
+ self.yellow("unittest SkipTest")
+ "\n"
+ self.white("top context, nested context: ")
+ self.bright("top context, nested context: ")
+ self.green("passing nested example")
+ "\n"
+ self.white("tests.sample_tests.SampleTestCase: ")
+ self.bright("tests.sample_tests.SampleTestCase: ")
+ self.red("test_failing: AssertionError: Third")
+ "\n"
+ self.white("tests.sample_tests.SampleTestCase: ")
+ self.bright("tests.sample_tests.SampleTestCase: ")
+ self.green("test_passing")
+ "\n"
+ self.white("tests.sample_tests.SampleTestCase: ")
+ self.bright("tests.sample_tests.SampleTestCase: ")
+ self.yellow("test_skipped")
+ "\n"
# TODO Rest of the output
Expand Down

0 comments on commit 9d89396

Please sign in to comment.