summaryrefslogtreecommitdiff
path: root/git/test/test_import.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2014-02-10 21:40:53 +0100
committerSebastian Thiel <byronimo@gmail.com>2014-02-10 21:40:53 +0100
commit1cb02ebcaa4891c01a1d6cba11a3cd9806fad782 (patch)
tree51130c659e5089434e84404940ed1451f6c5d5cc /git/test/test_import.py
parent660bdca125aa9dcca7a7730535bec433edb8ba02 (diff)
parentf77230f618722e964a76657ebb03d822b2f73518 (diff)
downloadgitpython-1cb02ebcaa4891c01a1d6cba11a3cd9806fad782.tar.gz
Merge branch 'feature/spaces-and-cleanup-master'
* feature/spaces-and-cleanup-master: Basic fixes to get tests back on track. Of course there is much more work to be done here removed leftover gitdb - I thought it was merged into git tabs to 4 spaces - overall state of this branch is desolate, but fixable. Needs plenty of work
Diffstat (limited to 'git/test/test_import.py')
-rw-r--r--git/test/test_import.py86
1 files changed, 43 insertions, 43 deletions
diff --git a/git/test/test_import.py b/git/test/test_import.py
index a5a1d11b..606d4b03 100644
--- a/git/test/test_import.py
+++ b/git/test/test_import.py
@@ -11,48 +11,48 @@ import os
from git import *
def import_all(topdir, topmodule='git', skip = "test"):
- base = os.path.basename
- join = os.path.join
- init_script = '__init__.py'
- prev_cwd = os.getcwd()
- try:
- os.chdir(os.path.dirname(topdir))
- for root, dirs, files in os.walk(base(topdir)):
- if init_script not in files:
- del(dirs[:])
- continue
- #END ignore non-packages
-
- if skip in root:
- continue
- #END handle ignores
-
- for relafile in files:
- if not relafile.endswith('.py'):
- continue
- if relafile == init_script:
- continue
- module_path = join(root, os.path.splitext(relafile)[0]).replace("/", ".").replace("\\", ".")
-
- m = __import__(module_path, globals(), locals(), [""])
- try:
- attrlist = m.__all__
- for attr in attrlist:
- assert hasattr(m, attr), "Invalid item in %s.__all__: %s" % (module_path, attr)
- #END veriy
- except AttributeError:
- pass
- # END try each listed attribute
- #END for each file in dir
- #END for each item
- finally:
- os.chdir(prev_cwd)
- #END handle previous currentdir
-
-
+ base = os.path.basename
+ join = os.path.join
+ init_script = '__init__.py'
+ prev_cwd = os.getcwd()
+ try:
+ os.chdir(os.path.dirname(topdir))
+ for root, dirs, files in os.walk(base(topdir)):
+ if init_script not in files:
+ del(dirs[:])
+ continue
+ #END ignore non-packages
+
+ if skip in root:
+ continue
+ #END handle ignores
+
+ for relafile in files:
+ if not relafile.endswith('.py'):
+ continue
+ if relafile == init_script:
+ continue
+ module_path = join(root, os.path.splitext(relafile)[0]).replace("/", ".").replace("\\", ".")
+
+ m = __import__(module_path, globals(), locals(), [""])
+ try:
+ attrlist = m.__all__
+ for attr in attrlist:
+ assert hasattr(m, attr), "Invalid item in %s.__all__: %s" % (module_path, attr)
+ #END veriy
+ except AttributeError:
+ pass
+ # END try each listed attribute
+ #END for each file in dir
+ #END for each item
+ finally:
+ os.chdir(prev_cwd)
+ #END handle previous currentdir
+
+
class TestDummy(object):
- def test_base(self):
- dn = os.path.dirname
- # NOTE: i don't think this is working, as the __all__ variable is not used in this case
- import_all(dn(dn(__file__)))
+ def test_base(self):
+ dn = os.path.dirname
+ # NOTE: i don't think this is working, as the __all__ variable is not used in this case
+ import_all(dn(dn(__file__)))