@@ -0,0 +1,2274 @@
+from __future__ import print_function, division, absolute_import%0A%0Aimport defcon%0A%0Afrom . import DATADIR%0Aimport pytest%0Aimport py%0A%0Afrom cu2qu.ufo import CURVE_TYPE_LIB_KEY%0Afrom cu2qu.cli import main%0A%0A%0ATEST_UFOS = %5B%0A    py.path.local(DATADIR).join(%22RobotoSubset-Regular.ufo%22),%0A    py.path.local(DATADIR).join(%22RobotoSubset-Bold.ufo%22),%0A%5D%0A%0A%0A@pytest.fixture%0Adef test_paths(tmpdir):%0A    result = %5B%5D%0A    for path in TEST_UFOS:%0A        new_path = tmpdir / path.basename%0A        path.copy(new_path)%0A        result.append(new_path)%0A    return result%0A%0A%0Aclass MainTest(object):%0A%0A    @staticmethod%0A    def run_main(*args):%0A        main(%5Bstr(p) for p in args if p%5D)%0A%0A    def test_single_input_no_output(self, test_paths):%0A        ufo_path = test_paths%5B0%5D%0A%0A        self.run_main(ufo_path)%0A%0A        font = defcon.Font(str(ufo_path))%0A        assert font.lib%5BCURVE_TYPE_LIB_KEY%5D == %22quadratic%22%0A%0A    def test_single_input_output_file(self, tmpdir):%0A        input_path = TEST_UFOS%5B0%5D%0A        output_path = tmpdir / input_path.basename%0A        self.run_main('-o', output_path, input_path)%0A%0A        assert output_path.check(dir=1)%0A%0A    def test_multiple_inputs_output_dir(self, tmpdir):%0A        output_dir = tmpdir / %22output_dir%22%0A        self.run_main('-d', output_dir, *TEST_UFOS)%0A%0A        assert output_dir.check(dir=1)%0A        outputs = set(p.basename for p in output_dir.listdir())%0A        assert %22RobotoSubset-Regular.ufo%22 in outputs%0A        assert %22RobotoSubset-Bold.ufo%22 in outputs%0A%0A    def test_interpolatable_inplace(self, test_paths):%0A        self.run_main('-i', *test_paths)%0A        self.run_main('-i', *test_paths)  # idempotent%0A%0A    @pytest.mark.parametrize(%0A        %22mode%22, %5B%22%22, %22-i%22%5D, ids=%5B%22normal%22, %22interpolatable%22%5D)%0A    def test_copytree(self, mode, tmpdir):%0A        output_dir = tmpdir / %22output_dir%22%0A        self.run_main(mode, '-d', output_dir, *TEST_UFOS)%0A%0A        output_dir_2 = tmpdir / %22output_dir_2%22%0A        # no conversion when curves are already quadratic, just copy%0A        self.run_main(mode, '-d', output_dir_2, *output_dir.listdir())%0A        # running again overwrites existing with the copy%0A        self.run_main(mode, '-d', output_dir_2, *output_dir.listdir())%0A%0A    def test_multiprocessing(self, tmpdir, test_paths):%0A        self.run_main(*(test_paths + %5B%22-j%22%5D))%0A

add cli_test.py