diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-25 18:10:33 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-25 18:18:15 +0100 |
commit | f8ce24a835cae8c623e2936bec2618a8855c605b (patch) | |
tree | d4c1d392579e24285381613a4ac1b7cc2d6b6fae /git/test/performance/lib.py | |
parent | 65747a216c67c3101c6ae2edaa8119d786b793cb (diff) | |
parent | 9004e3a1cf33110f2cbc458f1dc3259c930ad9b4 (diff) | |
download | gitpython-f8ce24a835cae8c623e2936bec2618a8855c605b.tar.gz |
-#######->WARNING<-####### Directory structure changed, see commit message
If you use git-python as a submodule of your own project, which alters the sys.path to import it,
you will have to adjust your code to take the changed directory structure into consideration.
Previously, you would put the path
./git-python/lib
into your syspath. All modules moved one level up into the 'git' subdirectory, which means that the 'git-python' directory
now contains the 'git' root package. To allow git to be found, add ./git-python into your path.
To finalize your update, run the following commands
git submodule update --init --recursive
As there will be left-over directories, consider running git-clean
Diffstat (limited to 'git/test/performance/lib.py')
-rw-r--r-- | git/test/performance/lib.py | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/git/test/performance/lib.py b/git/test/performance/lib.py new file mode 100644 index 00000000..d0727b60 --- /dev/null +++ b/git/test/performance/lib.py @@ -0,0 +1,78 @@ +"""Contains library functions""" +import os +from git.test.lib import * +import shutil +import tempfile + +from git.db import ( + GitCmdObjectDB, + GitDB + ) + +from git import ( + Repo + ) + +#{ Invvariants +k_env_git_repo = "GIT_PYTHON_TEST_GIT_REPO_BASE" +#} END invariants + + +#{ Utilities +def resolve_or_fail(env_var): + """:return: resolved environment variable or raise EnvironmentError""" + try: + return os.environ[env_var] + except KeyError: + raise EnvironmentError("Please set the %r envrionment variable and retry" % env_var) + # END exception handling + +#} END utilities + + +#{ Base Classes + +class TestBigRepoR(TestBase): + """TestCase providing access to readonly 'big' repositories using the following + member variables: + + * gitrorepo + + * Read-Only git repository - actually the repo of git itself + + * puregitrorepo + + * As gitrepo, but uses pure python implementation + """ + + #{ Invariants + head_sha_2k = '235d521da60e4699e5bd59ac658b5b48bd76ddca' + head_sha_50 = '32347c375250fd470973a5d76185cac718955fd5' + #} END invariants + + @classmethod + def setUpAll(cls): + super(TestBigRepoR, cls).setUpAll() + repo_path = resolve_or_fail(k_env_git_repo) + cls.gitrorepo = Repo(repo_path, odbt=GitCmdObjectDB) + cls.puregitrorepo = Repo(repo_path, odbt=GitDB) + + +class TestBigRepoRW(TestBigRepoR): + """As above, but provides a big repository that we can write to. + + Provides ``self.gitrwrepo`` and ``self.puregitrwrepo``""" + + @classmethod + def setUpAll(cls): + super(TestBigRepoRW, cls).setUpAll() + dirname = tempfile.mktemp() + os.mkdir(dirname) + cls.gitrwrepo = cls.gitrorepo.clone(dirname, shared=True, bare=True, odbt=GitCmdObjectDB) + cls.puregitrwrepo = Repo(dirname, odbt=GitDB) + + @classmethod + def tearDownAll(cls): + shutil.rmtree(cls.gitrwrepo.working_dir) + +#} END base classes |