Ejemplo n.º 1
0
    def test_convenience(self):
        expected_path = sys.path.pop(0)
        sys.path.insert(0, gitimport.repository_path(self.repo, in_repo_path='import_testmodules'))
        self.assertEqual(expected_path, sys.path.pop(0))

        sys.path.insert(0, gitimport.repository_path('.', in_repo_path='import_testmodules'))
        self.assertEqual(expected_path, sys.path.pop(0))

        gitimport.add_repository_to_path('.', in_repo_path='import_testmodules')
        self.assertEqual(expected_path, sys.path.pop(0))
        sys.path.insert(0, expected_path)
Ejemplo n.º 2
0
 def setUp(self):
     gitimport.add_gitimporter_path_hook()
     self.repo = repo = pygit2.Repository('.')
     self.commit_sha = repo.revparse_single('HEAD').hex
     sys.path.insert(0,'/a/repo/that/does/not/exist@fffff00')
     sys.path.insert(0, gitimport.repository_path(self.repo, in_repo_path='import_testmodules'))
Ejemplo n.º 3
0
 def test_repository_path(self):
     path = gitimport.repository_path(self.repo)
     self.assertEqual(path, self.repo.path + "@" + self.commit_sha + '/')