Exemplo n.º 1
0
 def test_no_mode_error(self):
     message = None
     try:
         run(StringIO(), [])
     except InvalidArgumentsError as e:
         message = e.args[0]
     assert('No mode specified' == message)
Exemplo n.º 2
0
 def test_unknown_mode_error(self):
     message = None
     try:
         run(StringIO(), ['foo'])
     except InvalidArgumentsError as e:
         message = e.args[0]
     assert('Unknown mode \'{}\''.format('foo') == message)
Exemplo n.º 3
0
 def test_no_config_error(self):
     caught = False
     try:
         run(StringIO(), ['walk', 'foo'])
     except NoConfigError as e:
         caught = True
     assert(caught)
Exemplo n.º 4
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.º 5
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.º 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_graph(self):
     f = StringIO()
     run(f, None, None, None, None, ['dot', 'p2'])
     lines = f.getvalue().split('\n')
     assert ('digraph G {' == lines[0])
     assert ('    "p2" -> "p1"' == lines[1])
     assert ('}' == lines[2])
Exemplo n.º 8
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.º 9
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.º 10
0
 def test_graph(self):
     f = StringIO()
     run(f, None, None, None, None, ['dot', 'p2'])
     lines = f.getvalue().split('\n')
     assert('digraph G {'      == lines[0])
     assert('    "p2" -> "p1"' == lines[1])
     assert('}'                == lines[2])
Exemplo n.º 11
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.º 12
0
    def test_target_with_dependencies(self):
        f = StringIO()
        run(f, None, None, None, None, ['walk', 'gr2'])

        r = TargetResolver(self._config)
        us = resolve(r, ['gr2'])

        assert (' '.join(u.name for u in us) + '\n' == f.getvalue())
Exemplo n.º 13
0
    def test_target_with_dependencies(self):
        f = StringIO()
        run(f, None, None, None, None, ['walk', 'gr2'])

        r  = TargetResolver(self._config)
        us = resolve(r, ['gr2'])

        assert(' '.join(u.name for u in us) + '\n' == f.getvalue())
Exemplo n.º 14
0
    def test_generate_cmake(self):
        output1 = StringIO()

        run(output1, None, output1, None, ['cmake', 'bdemeta.json', 'p'])

        r       = TargetResolver(self._config)
        p       = resolve(r, 'p')
        output2 = StringIO()
        generate(p, output2)

        assert(output1.getvalue() == output2.getvalue())
Exemplo n.º 15
0
    def test_generate_cmake(self):
        output = StringIO()

        f1 = {}
        w1 = get_filestore_writer(f1)

        run(output, None, w1, None, None, ['cmake', 'p'])

        r = TargetResolver(self._config)
        p = resolve(r, 'p')
        f2 = {}
        w2 = get_filestore_writer(f2)
        generate(p, w2)

        assert (f1.keys() == f2.keys())
        for k in f1:
            assert (f1[k].getvalue() == f2[k].getvalue())
Exemplo n.º 16
0
    def test_generate_cmake(self):
        output = StringIO()

        f1 = {}
        w1 = get_filestore_writer(f1)

        run(output, None, w1, None, None, ['cmake', 'p'])

        r  = TargetResolver(self._config)
        p  = resolve(r, 'p')
        f2 = {}
        w2 = get_filestore_writer(f2)
        generate(p, w2)

        assert(f1.keys() == f2.keys())
        for k in f1:
            assert(f1[k].getvalue() == f2[k].getvalue())
Exemplo n.º 17
0
 def test_no_root_error(self):
     with self.assertRaises(InvalidPathError) as e:
         run(None, None, None, None, None, ['walk'])
     assert (P('r') == e.exception.args[0])
Exemplo n.º 18
0
 def test_unknown_mode_error(self):
     with self.assertRaises(InvalidArgumentsError) as e:
         run(None, None, None, None, None, ['foo'])
     assert ('Unknown mode \'{}\''.format('foo') == e.exception.args[0])
Exemplo n.º 19
0
 def test_unknown_mode_error(self):
     with self.assertRaises(InvalidArgumentsError) as e:
         run(None, None, None, None, None, ['foo'])
     assert('Unknown mode \'{}\''.format('foo') == e.exception.args[0])
Exemplo n.º 20
0
 def test_no_root_error(self):
     with self.assertRaises(InvalidPathError) as e:
         run(None, None, None, None, None, ['walk'])
     assert(P('r') == e.exception.args[0])
Exemplo n.º 21
0
 def test_no_mode_error(self):
     with self.assertRaises(InvalidArgumentsError) as e:
         run(None, None, None, None, None, [])
     assert ('No mode specified' == e.exception.args[0])
Exemplo n.º 22
0
 def test_no_config_error(self):
     with self.assertRaises(InvalidArgumentsError) as e:
         run(None, None, None, None, ['walk'])
     assert('No config specified' == e.exception.args[0])
Exemplo n.º 23
0
 def test_no_mode_error(self):
     with self.assertRaises(InvalidArgumentsError) as e:
         run(None, None, None, None, None, [])
     assert('No mode specified' == e.exception.args[0])