Exemplo n.º 1
0
 def test_run_empty(self):
     with tempfile.TemporaryDirectory() as inp, \
             tempfile.TemporaryDirectory() as out:
         cmd = "template %s/tt" % inp
         cmain._main(*cmd.split())
         cmd = "batch %s -O %s" % (inp, out)
         cmain._main(*cmd.split())
Exemplo n.º 2
0
 def test_run_demos(self):
     with tempfile.TemporaryDirectory() as inp, \
             tempfile.TemporaryDirectory() as out:
         cmd = "demo %s" % inp
         cmain._main(*cmd.split())
         cmd = "batch -v -O %s %s" % (out, inp)
         cmain._main(*cmd.split())
Exemplo n.º 3
0
 def test_Gen_template(self):
     gen_files = ['t1', 'tt2.xlsx']
     exp_files = ['t1.xlsx', 'tt2.xlsx']
     with tempfile.TemporaryDirectory() as d:
         gen_files = [os.path.join(d, f) for f in gen_files]
         cmd = "template %s" % ' '.join(gen_files)
         cmain._main(*cmd.split())
         files = os.listdir(path=d)
         self.assertSetEqual(set(files), set(exp_files))
Exemplo n.º 4
0
    def test_Gen_demo_inputs(self):
        exp_path = (mydir, '..', 'co2mpas', 'demos', '*.xlsx')
        exp_files = [os.path.basename(f)
                     for f in glob.glob(os.path.join(*exp_path))]

        with tempfile.TemporaryDirectory() as d:
            cmd = "demo %s" % d
            cmain._main(*cmd.split())
            files = os.listdir(path=d)
            self.assertSetEqual(set(files), set(exp_files))
Exemplo n.º 5
0
    def test_Gen_demo_inputs(self):
        import co2mpas  # checking *installed* package

        exp_glob = osp.join(osp.dirname(co2mpas.__file__), 'demos', '*.xlsx')
        exp_files = [os.path.basename(f) for f in glob.glob(exp_glob)]

        with tempfile.TemporaryDirectory() as d:
            cmd = "demo %s" % d
            cmain._main(*cmd.split())
            files = os.listdir(path=d)
            self.assertSetEqual(set(files), set(exp_files))
Exemplo n.º 6
0
    def test_Version(self):
        cmd = "-v --version"
        stdout = io.StringIO()
        with patch('sys.stdout', stdout):
            cmain._main(*cmd.split())
        s = stdout.getvalue()
        self.assertIn(proj_ver, s),
        self.assertIn(sys.prefix, s),
        self.assertIn(sys.version, s),

        cmd = "--version"
        stdout = io.StringIO()
        with patch('sys.stdout', stdout):
            cmain._main(*cmd.split())
        s = stdout.getvalue()
        self.assertIn(proj_ver, s),
        self.assertNotIn(sys.prefix, s),
        self.assertNotIn(sys.version, s),
Exemplo n.º 7
0
 def test_plot_graphs_depth(self, case):
     cmd = "modelgraph %s %s" % (case, self.model)
     cmain._main(*cmd.split())