Example #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())
Example #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())
Example #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())
Example #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())
Example #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())
Example #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())
Example #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())
Example #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())
Example #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())
Example #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())
Example #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())
Example #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)
Example #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)
Example #14
0
 def test_walk(self):
     stdout = StringIO()
     main(stdout, None, None, None, None, [None, 'walk', 'p2'])
     assert ('p2 p1\n' == stdout.getvalue())
Example #15
0
 def test_walk(self):
     stdout = StringIO()
     main(stdout, None, None, None, None, [None, 'walk', 'p2'])
     assert('p2 p1\n' == stdout.getvalue())
Example #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())
Example #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())
Example #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())
Example #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())
Example #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())