diff --git a/tests/test_wakatime_project.py b/tests/test_wakatime_project.py index e909b55..b4e481f 100644 --- a/tests/test_wakatime_project.py +++ b/tests/test_wakatime_project.py @@ -105,7 +105,7 @@ class LanguagesTestCase(utils.TestCase): entity = 'tests/samples/projects/project_map/emptyfile.txt' fh.write(open('tests/samples/project_map.cfg').read().encode('utf-8')) - fh.write('{0} = proj-map'.format(os.path.realpath(os.path.dirname(entity))).encode('utf-8')) + fh.write('{0} = proj-map'.format(os.path.realpath(os.path.dirname(os.path.dirname(entity)))).encode('utf-8')) fh.flush() config = fh.name diff --git a/wakatime/logger.py b/wakatime/logger.py index b0732b2..d315e3b 100644 --- a/wakatime/logger.py +++ b/wakatime/logger.py @@ -20,8 +20,8 @@ except ImportError: from .packages.ordereddict import OrderedDict # pragma: nocover try: from .packages import simplejson as json # pragma: nocover -except (ImportError, SyntaxError): - import json # pragma: nocover +except (ImportError, SyntaxError): # pragma: nocover + import json class CustomEncoder(json.JSONEncoder): diff --git a/wakatime/projects/git.py b/wakatime/projects/git.py index db6c3f2..2e8b561 100644 --- a/wakatime/projects/git.py +++ b/wakatime/projects/git.py @@ -30,7 +30,7 @@ class Git(BaseProject): base = self._project_base() if base: return u(os.path.basename(base)) - return None + return None # pragma: nocover def branch(self): base = self._project_base() @@ -39,13 +39,13 @@ class Git(BaseProject): try: with open(head, 'r', encoding='utf-8') as fh: return u(fh.readline().strip().rsplit('/', 1)[-1]) - except UnicodeDecodeError: + except UnicodeDecodeError: # pragma: nocover try: with open(head, 'r', encoding=sys.getfilesystemencoding()) as fh: return u(fh.readline().strip().rsplit('/', 1)[-1]) except: log.exception("Exception:") - except IOError: + except IOError: # pragma: nocover log.exception("Exception:") return None diff --git a/wakatime/projects/projectmap.py b/wakatime/projects/projectmap.py index 44b19fc..f6b4fc2 100644 --- a/wakatime/projects/projectmap.py +++ b/wakatime/projects/projectmap.py @@ -47,14 +47,14 @@ class ProjectMap(BaseProject): if self._configs.get(path.lower()): return self._configs.get(path.lower()) - if self._configs.get('%s/' % path.lower()): + if self._configs.get('%s/' % path.lower()): # pragma: nocover return self._configs.get('%s/' % path.lower()) - if self._configs.get('%s\\' % path.lower()): + if self._configs.get('%s\\' % path.lower()): # pragma: nocover return self._configs.get('%s\\' % path.lower()) split_path = os.path.split(path) if split_path[1] == '': - return None + return None # pragma: nocover return self._find_project(split_path[0]) def branch(self): @@ -63,4 +63,4 @@ class ProjectMap(BaseProject): def name(self): if self.project: return u(self.project) - return None + return None # pragma: nocover diff --git a/wakatime/projects/wakatime_project_file.py b/wakatime/projects/wakatime_project_file.py index 3b1b8db..2b9ada5 100644 --- a/wakatime/projects/wakatime_project_file.py +++ b/wakatime/projects/wakatime_project_file.py @@ -35,14 +35,14 @@ class WakaTimeProjectFile(BaseProject): with open(self.config, 'r', encoding='utf-8') as fh: self._project_name = u(fh.readline().strip()) self._project_branch = u(fh.readline().strip()) - except UnicodeDecodeError: + except UnicodeDecodeError: # pragma: nocover try: with open(self.config, 'r', encoding=sys.getfilesystemencoding()) as fh: self._project_name = u(fh.readline().strip()) self._project_branch = u(fh.readline().strip()) except: log.exception("Exception:") - except IOError: + except IOError: # pragma: nocover log.exception("Exception:") return True