[codeface] [PATCH 02/12] Changes to make the files better standalone executable within pydev IDE (especially unit tests).

  • From: Matthias Dittrich <matthi.d@xxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Wed, 19 Nov 2014 21:40:21 +0100

Use qualified imports instead of relative ones. This makes it clear which 
module we want to import.
Handle some special case when we are within a unit test.

Signed-off-by: Matthias Dittrich <matthi.d@xxxxxxxxx>
Reviewed-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxx>
---
 codeface/cli.py                                   | 8 ++++----
 codeface/test/integration/test_exampleprojects.py | 6 +++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/codeface/cli.py b/codeface/cli.py
index 53de874..708b6b5 100644
--- a/codeface/cli.py
+++ b/codeface/cli.py
@@ -26,10 +26,10 @@ from pkg_resources import resource_filename
 
 from glob import glob
 
-from .logger import set_log_level, start_logfile, log
-from .configuration import Configuration
-from .util import execute_command
-from .project import project_analyse, mailinglist_analyse
+from codeface.logger import set_log_level, start_logfile, log
+from codeface.configuration import Configuration
+from codeface.util import execute_command
+from codeface.project import project_analyse, mailinglist_analyse
 
 def get_parser():
     parser = argparse.ArgumentParser(prog='codeface',
diff --git a/codeface/test/integration/test_exampleprojects.py 
b/codeface/test/integration/test_exampleprojects.py
index 1eae0f5..09d48ee 100644
--- a/codeface/test/integration/test_exampleprojects.py
+++ b/codeface/test/integration/test_exampleprojects.py
@@ -22,6 +22,7 @@ from textwrap import dedent
 from os.path import dirname, join as pathjoin
 from pkg_resources import load_entry_point
 
+from codeface.logger import set_log_level, start_logfile, log
 from .example_projects import example_project_func
 from codeface.project import project_analyse, mailinglist_analyse
 from codeface.configuration import Configuration
@@ -95,7 +96,10 @@ class EndToEndTestSetup(unittest.TestCase):
         self.logfile = pathjoin(path, ".git", "log")
         self.recreate = False
         # This config_file is added in the codeface test command handler
-        self.codeface_conf = self.config_file
+        if hasattr(self, 'config_file'):
+            self.codeface_conf = self.config_file
+        else:
+            self.codeface_conf = 'codeface_testing.conf'
         conf = Configuration.load(self.codeface_conf, self.project_conf)
         dbm = DBManager(conf)
         for table in pid_tables + other_tables:
-- 
1.8.5.5


Other related posts:

  • » [codeface] [PATCH 02/12] Changes to make the files better standalone executable within pydev IDE (especially unit tests). - Matthias Dittrich