Exemplo n.º 1
0
    def test_invalid_path_error(self):
        with self.assertRaises(InvalidPathError):
            run(None, None, None, None, None, ['walk', 'foo'])

        stderr = StringIO()
        main(None, stderr, None, None, None, [__name__, 'walk', 'foo'])
        assert(stderr.getvalue())
Exemplo n.º 2
0
    def test_no_config_error(self):
        with self.assertRaises(NoConfigError):
            run(None, None, None, None, None, ['walk', 'foo'])

        stderr = StringIO()
        main(None, stderr, None, None, None, [__name__, 'walk', 'foo'])
        assert(stderr.getvalue())
Exemplo n.º 3
0
    def test_args_error_if_config_unneeded(self):
        with self.assertRaises(InvalidArgumentsError):
            run(None, None, None, None, None, [])

        stderr = StringIO()
        main(None, stderr, None, None, None, [__name__])
        assert(stderr.getvalue())
Exemplo n.º 4
0
 def test_not_found_error(self):
     stdout = StringIO()
     stderr = StringIO()
     main(stdout, stderr, None, None, None, [__name__, 'walk', 'p5'])
     assert(not stdout.getvalue())
     assert(stderr.getvalue())
     assert('p5' in stderr.getvalue())
Exemplo n.º 5
0
 def test_not_found_error(self):
     stdout = StringIO()
     stderr = StringIO()
     main(stdout, stderr, None, None, None, [__name__, 'walk', 'p5'])
     assert (not stdout.getvalue())
     assert (stderr.getvalue())
     assert ('p5' in stderr.getvalue())
Exemplo n.º 6
0
    def test_no_config_error(self):
        with self.assertRaises(NoConfigError):
            run(None, None, None, None, None, ['walk', 'foo'])

        stderr = StringIO()
        main(None, stderr, None, None, None, [__name__, 'walk', 'foo'])
        assert (stderr.getvalue())
Exemplo n.º 7
0
    def test_args_error_if_config_unneeded(self):
        with self.assertRaises(InvalidArgumentsError):
            run(None, None, None, None, None, [])

        stderr = StringIO()
        main(None, stderr, None, None, None, [__name__])
        assert (stderr.getvalue())
Exemplo n.º 8
0
    def test_invalid_path_error(self):
        with self.assertRaises(InvalidPathError):
            run(None, None, None, None, None, ['walk', 'foo'])

        stderr = StringIO()
        main(None, stderr, None, None, None, [__name__, 'walk', 'foo'])
        assert (stderr.getvalue())
Exemplo n.º 9
0
 def test_cyclic_error(self):
     stdout = StringIO()
     stderr = StringIO()
     main(stdout, stderr, None, None, None, [__name__, 'walk', 'p3'])
     assert(not stdout.getvalue())
     assert(stderr.getvalue())
     assert('p3' in stderr.getvalue())
     assert('p4' in stderr.getvalue())
Exemplo n.º 10
0
 def test_cyclic_error(self):
     stdout = StringIO()
     stderr = StringIO()
     main(stdout, stderr, None, None, None, [__name__, 'walk', 'p3'])
     assert (not stdout.getvalue())
     assert (stderr.getvalue())
     assert ('p3' in stderr.getvalue())
     assert ('p4' in stderr.getvalue())
Exemplo n.º 11
0
 def test_no_config_error(self):
     stdout = StringIO()
     stderr = StringIO()
     main(stdout,
          stderr,
          None,
          None,
          [__name__, 'walk', 'bdemeta.json', 'p1'])
     assert(not stdout.getvalue())
     assert(stderr.getvalue())
Exemplo n.º 12
0
    def test_running_tests(self):
        stdout1 = StringIO()
        stderr1 = StringIO()
        runner1 = MockRunner('sfsf')
        main(stdout1, stderr1, None, runner1, lambda: 80,
             [__name__, 'runtests', 'foo'])

        stdout2 = StringIO()
        stderr2 = StringIO()
        runner2 = MockRunner('sfsf')
        run_tests(stdout2, stderr2, runner2, lambda: 80, ['foo'])

        assert (stdout1.getvalue() == stdout2.getvalue())
        assert (stderr1.getvalue() == stderr2.getvalue())
        assert (runner1.commands == runner2.commands)
Exemplo n.º 13
0
    def test_running_tests(self):
        stdout1 = StringIO()
        stderr1 = StringIO()
        runner1 = MockRunner('sfsf')
        main(stdout1,
             stderr1,
             runner1,
             lambda: 80,
             [__name__, 'runtests', 'foo'])

        stdout2 = StringIO()
        stderr2 = StringIO()
        runner2 = MockRunner('sfsf')
        run_tests(stdout2, stderr2, runner2, lambda: 80, ['foo'])

        assert(stdout1.getvalue() == stdout2.getvalue())
        assert(stderr1.getvalue() == stderr2.getvalue())
        assert(runner1.commands   == runner2.commands)
Exemplo n.º 14
0
 def test_walk(self):
     stdout = StringIO()
     main(stdout, None, None, None, None, [None, 'walk', 'p2'])
     assert ('p2 p1\n' == stdout.getvalue())
Exemplo n.º 15
0
 def test_walk(self):
     stdout = StringIO()
     main(stdout, None, None, None, None, [None, 'walk', 'p2'])
     assert('p2 p1\n' == stdout.getvalue())
Exemplo n.º 16
0
 def test_error(self):
     stdout = StringIO()
     stderr = StringIO()
     main(stdout, stderr, None, None, None, [__name__, 'foo'])
     assert(not stdout.getvalue())
     assert(stderr.getvalue())
Exemplo n.º 17
0
 def test_no_config_error(self):
     stdout = StringIO()
     stderr = StringIO()
     main(stdout, stderr, None, None, None, [__name__, 'walk', 'p1'])
     assert (not stdout.getvalue())
     assert (stderr.getvalue())
Exemplo n.º 18
0
 def test_help_text(self):
     stdout = StringIO()
     stderr = StringIO()
     main(stdout, stderr, None, None, None, [__name__])
     assert (not stdout.getvalue())
     assert (stderr.getvalue())
Exemplo n.º 19
0
 def test_help_text(self):
     stdout = StringIO()
     stderr = StringIO()
     main(stdout, stderr, None, None, None, [__name__])
     assert(not stdout.getvalue())
     assert(stderr.getvalue())
Exemplo n.º 20
0
 def test_error(self):
     stdout = StringIO()
     stderr = StringIO()
     main(stdout, stderr, None, None, None, [__name__, 'foo'])
     assert (not stdout.getvalue())
     assert (stderr.getvalue())