From 2c17f9e9117ce3a95c3f9959d83ad16566c3efe1 Mon Sep 17 00:00:00 2001 From: Kelsey Prantis Date: Fri, 4 May 2012 15:17:12 -0600 Subject: [PATCH 1/2] Continue if exclude-dir doesn't exist, just log warning. --- nose_exclude.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nose_exclude.py b/nose_exclude.py index aa9600d..65cee0d 100644 --- a/nose_exclude.py +++ b/nose_exclude.py @@ -34,7 +34,7 @@ class NoseExclude(Plugin): if os.path.exists(abspath): return abspath else: - raise ValueError("invalid path: %s" % pathname) + log.warn('The following path was not found: %s' % pathname) def _load_from_file(self, filename): infile = open(filename) @@ -72,7 +72,8 @@ class NoseExclude(Plugin): for d in exclude_param.split('\n'): d = d.strip() abs_d = self._force_to_abspath(d) - self.exclude_dirs[abs_d] = True + if abs_d: + self.exclude_dirs[abs_d] = True exclude_str = "excluding dirs: %s" % ",".join(self.exclude_dirs.keys()) log.debug(exclude_str) From e6ac4f746cd8094243050651e70d71a89f58dca7 Mon Sep 17 00:00:00 2001 From: Kelsey Prantis Date: Fri, 4 May 2012 15:25:47 -0600 Subject: [PATCH 2/2] Test providing a non-existant directory as a exclude-dir --- tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests.py b/tests.py index 743af8a..e825e7e 100644 --- a/tests.py +++ b/tests.py @@ -59,5 +59,17 @@ class TestNoseExcludeDirs_Relative_Args_Mixed(PluginTester, unittest.TestCase): def test_proper_dirs_omitted(self): assert "FAILED" not in self.output +class TestNoseExcludeDirs_Arg_Does_Not_Exist(PluginTester, unittest.TestCase): + """Test nose-exclude directories for a directory that doesn't exist. + """ + + activate = "--exclude-dir=test_dirs/build" + args = ["--exclude-dir=test_dirs/test_not_me \n --exclude-dir=test_dirs/test_i_dont_exist"] + plugins = [NoseExclude()] + suitepath = os.path.join(os.getcwd(), 'test_dirs') + + def test_proper_dirs_omitted(self): + assert "FAILED" not in self.output + if __name__ == '__main__': unittest.main()