def test_display_windows_with_ansi(self, mock_print, mock_sys, mock_init, mock_deinit): mock_sys.platform = 'win32' display = Display() display.display_string = 'foobar' display.force_ansi = True display.display() mock_init.assert_not_called() mock_print.assert_called_once_with('foobar') mock_deinit.assert_called()
def test_display_non_windows(self, mock_print, mock_sys, mock_init, mock_deinit): mock_sys.platform = 'foobarbaz' display = Display() display.display_string = 'foobar' display.force_ansi = False display.display() mock_init.assert_not_called() mock_print.assert_called_once_with('foobar') mock_deinit.assert_called()
def jasper(test_directory, ansi, v): """ The entrypoint of the application. Runs Jasper tests within a given directory and displays the results. :param test_directory: The directory containing feature files to run. :param ansi: A flag for whether or not to force ansi escape sequences in the display for coloring purposes. :param v: A verbosity level for the display. Ranges from 0 to 2. """ runner = Runner(test_directory) completed_suite = runner.run() display = Display(force_ansi=ansi, verbosity_level=v) display.prepare_suite(completed_suite) display.display()