コード例 #1
0
ファイル: test_commands.py プロジェクト: exu1977/vcstool
 def test_import_force_non_empty(self):
     workdir = os.path.join(TEST_WORKSPACE, 'force-non-empty')
     os.makedirs(os.path.join(workdir, 'vcstool', 'not-a-git-repo'))
     try:
         output = run_command('import',
                              ['--force', '--input', REPOS_FILE, '.'],
                              subfolder='force-non-empty')
         expected = get_expected_output('import')
         # newer git versions don't append ... after the commit hash
         assert (output == expected
                 or output == expected.replace(b'... ', b' '))
     finally:
         rmtree(workdir)
コード例 #2
0
ファイル: test_commands.py プロジェクト: exu1977/vcstool
 def test_import_url(self):
     workdir = os.path.join(TEST_WORKSPACE, 'import-url')
     os.makedirs(workdir)
     try:
         output = run_command('import', ['--input', REPOS_FILE_URL, '.'],
                              subfolder='import-url')
         # the actual output contains absolute paths
         output = output.replace(
             b'repository in ' + workdir.encode() + b'/',
             b'repository in ./')
         expected = get_expected_output('import')
         # newer git versions don't append ... after the commit hash
         assert (output == expected
                 or output == expected.replace(b'... ', b' '))
     finally:
         rmtree(workdir)
コード例 #3
0
ファイル: test_commands.py プロジェクト: exu1977/vcstool
    def test_import_shallow(self):
        workdir = os.path.join(TEST_WORKSPACE, 'import-shallow')
        os.makedirs(workdir)
        try:
            output = run_command('import',
                                 ['--shallow', '--input', REPOS_FILE, '.'],
                                 subfolder='import-shallow')
            # the actual output contains absolute paths
            output = output.replace(
                b'repository in ' + workdir.encode() + b'/',
                b'repository in ./')
            expected = get_expected_output('import_shallow')
            # newer git versions don't append ... after the commit hash
            assert (output == expected
                    or output == expected.replace(b'... ', b' '))

            # check that repository history has only one commit
            output = subprocess.check_output(
                ['git', 'log', '--format=oneline'],
                stderr=subprocess.STDOUT,
                cwd=os.path.join(workdir, 'vcstool'))
            assert len(output.splitlines()) == 1
        finally:
            rmtree(workdir)
コード例 #4
0
ファイル: test_commands.py プロジェクト: exu1977/vcstool
 def tearDownClass(cls):
     rmtree(TEST_WORKSPACE)