示例#1
0
    def test_parse_file(self):
        target_dir = join(self.tmp_dir, 'data')
        shutil.copytree(SAMPLE_PACKAGE_DIR, target_dir)
        target_file = join(target_dir, 'main.py')
        expect_file = join(target_dir, 'main.pye')

        subprocess.check_call(
            '%s pyconcrete-admin.py compile --source=%s --pye --verbose' % (sys.executable, target_file),
            env=base.get_pyconcrete_env_path(),
            shell=True,
        )

        self.assertTrue(exists(expect_file))
示例#2
0
    def test_ignore_file_list_match_not_in_seq(self):
        expect_file1 = join(self.tmp_dir, 'test1.pye')
        expect_file2 = join(self.tmp_dir, 'test2.pye')

        subprocess.check_call(
            ('%s pyconcrete-admin.py compile --source=%s --pye --verbose -i main.py test[!1,3].py'
             % (sys.executable, self.tmp_dir)),
            env=base.get_pyconcrete_env_path(),
            shell=True,
        )

        self.assertTrue(exists(expect_file1))
        self.assertFalse(exists(expect_file2))
示例#3
0
    def test_ignore_file_list_match_not_in_seq(self):
        expect_file1 = join(self.tmp_dir, 'test1.pye')
        expect_file2 = join(self.tmp_dir, 'test2.pye')

        subprocess.check_call(
            ('%s pyconcrete-admin.py compile --source=%s --pye --verbose -i main.py test[!1,3].py'
             % (sys.executable, self.tmp_dir)),
            env=base.get_pyconcrete_env_path(),
            shell=True,
        )

        self.assertTrue(exists(expect_file1))
        self.assertFalse(exists(expect_file2))
示例#4
0
    def test_parse_file(self):
        target_dir = join(self.tmp_dir, 'data')
        shutil.copytree(SAMPLE_PACKAGE_DIR, target_dir)
        target_file = join(target_dir, 'main.py')
        expect_file = join(target_dir, 'main.pye')

        subprocess.check_call(
            '%s pyconcrete-admin.py compile --source=%s --pye --verbose' % (sys.executable, target_file),
            env=base.get_pyconcrete_env_path(),
            shell=True,
        )

        self.assertTrue(exists(expect_file))
示例#5
0
        def test_pattern(pat):
            subprocess.check_call(
                ('%s pyconcrete-admin.py compile --source=%s --pye --verbose -i %s'
                 % (sys.executable, self.tmp_dir, pat)),
                env=base.get_pyconcrete_env_path(),
                shell=True,
            )

            self.assertTrue(exists(expect_file1))
            self.assertTrue(exists(expect_file2))
            # test.py excluded
            self.assertFalse(exists(expect_file3))
            self.assertTrue(exists(expect_file4))
            self.assertTrue(exists(expect_file5))
示例#6
0
        def test_pattern(pat):
            subprocess.check_call(
                ('%s pyconcrete-admin.py compile --source=%s --pye --verbose -i %s'
                 % (sys.executable, self.tmp_dir, pat)),
                env=base.get_pyconcrete_env_path(),
                shell=True,
            )

            self.assertTrue(exists(expect_file1))
            self.assertTrue(exists(expect_file2))
            # test.py excluded
            self.assertFalse(exists(expect_file3))
            self.assertTrue(exists(expect_file4))
            self.assertTrue(exists(expect_file5))
示例#7
0
    def test_ignore_file_list_match_in_seq(self):
        target_dir = join(self.tmp_dir, 'data')
        shutil.copytree(SAMPLE_PACKAGE_DIR, target_dir)

        expect_file1 = join(target_dir, 'test1.pye')
        expect_file2 = join(target_dir, 'test2.pye')

        subprocess.check_call(
            ('%s pyconcrete-admin.py compile --source=%s --pye --verbose -i main.py test[1,3].py'
             % (sys.executable, target_dir)),
            env=base.get_pyconcrete_env_path(),
            shell=True,
        )

        self.assertFalse(exists(expect_file1))
        self.assertTrue(exists(expect_file2))
示例#8
0
    def test_parse_folder(self):
        target_dir = join(self.tmp_dir, 'data')
        # print 'src=%s, target=%s' % (SAMPLE_PACKAGE_DIR, target_dir)
        shutil.copytree(SAMPLE_PACKAGE_DIR, target_dir)
        expect_file1 = join(target_dir, '__init__.pye')
        expect_file2 = join(target_dir, 'main.pye')

        subprocess.check_call(
            'python pyconcrete-admin.py compile --source=%s --pye --verbose' %
            target_dir,
            env=base.get_pyconcrete_env_path(),
            shell=True,
        )

        self.assertTrue(exists(expect_file1))
        self.assertTrue(exists(expect_file2))
示例#9
0
    def test_ignore_file_list_match_single(self):
        target_dir = join(self.tmp_dir, 'data')
        shutil.copytree(SAMPLE_PACKAGE_DIR, target_dir)

        expect_file1 = join(target_dir, '__init__.pye')
        expect_file2 = join(target_dir, 'main.pye')
        expect_file3 = join(self.tmp_dir, 'test1.pye')
        expect_file4 = join(self.tmp_dir, 'test2.pye')

        subprocess.check_call(
            ('%s pyconcrete-admin.py compile --source=%s --pye --verbose -i main.py test?.py'
             % (sys.executable, self.tmp_dir)),
            env=base.get_pyconcrete_env_path(),
            shell=True,
        )

        self.assertTrue(exists(expect_file1))
        self.assertFalse(exists(expect_file2))
        self.assertFalse(exists(expect_file3))
        self.assertFalse(exists(expect_file4))
示例#10
0
    def test_ignore_file_list_match(self):
        target_dir = join(self.tmp_dir, 'data')
        relative_import_dir = join(self.tmp_dir, 'data', 'relative_import')
        shutil.copytree(SAMPLE_PACKAGE_DIR, target_dir)

        expect_file1 = join(target_dir, 'main.pye')
        # relative_import/util.pye
        expect_file2 = join(relative_import_dir, 'util.pye')
        # relative_import/main.pye
        expect_file3 = join(relative_import_dir, 'main.pye')

        subprocess.check_call(
            ('%s pyconcrete-admin.py compile --source=%s --pye --verbose -i relative_import/util.py'
             % (sys.executable, target_dir)),
            env=base.get_pyconcrete_env_path(),
            shell=True,
        )

        self.assertTrue(exists(expect_file1))
        self.assertFalse(exists(expect_file2))
        self.assertTrue(exists(expect_file3))
示例#11
0
    def test_ignore_file_list_match(self):
        target_dir = join(self.tmp_dir, 'data')
        relative_import_dir = join(self.tmp_dir, 'data', 'relative_import')
        shutil.copytree(SAMPLE_PACKAGE_DIR, target_dir)

        expect_file1 = join(target_dir, 'main.pye')
        # relative_import/util.pye
        expect_file2 = join(relative_import_dir, 'util.pye')
        # relative_import/main.pye
        expect_file3 = join(relative_import_dir, 'main.pye')

        subprocess.check_call(
            ('%s pyconcrete-admin.py compile --source=%s --pye --verbose -i relative_import/util.py'
             % (sys.executable, target_dir)),
            env=base.get_pyconcrete_env_path(),
            shell=True,
        )

        self.assertTrue(exists(expect_file1))
        self.assertFalse(exists(expect_file2))
        self.assertTrue(exists(expect_file3))