From d3b81773a20d380c95c8786cc12d0cc8fc7136eb Mon Sep 17 00:00:00 2001 From: Tomas Matlovic <tomas.matlovic@gmail.com> Date: Wed, 27 Nov 2019 14:27:37 +0100 Subject: [PATCH] #145 Fix empty files causing testmon to crash We were creating Module based on code variable value. When file is empty code was empty string and we didnt create Module instance, instead we returned None. This was causing crash in make_nodedata because file exists but module instance was None. Not we create Module instance based on checksum value. Checksum is defined even if file is empty. --- setup.py | 2 +- testmon/testmon_core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 35f53c4..f5e0373 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ name="pytest-testmon", description="selects tests affected by changes files and methods", long_description=long_description, - version='1.0.0', + version="1.0.1", license="AGPL", platforms=["linux", "osx", "win32"], packages=["testmon",], diff --git a/testmon/testmon_core.py b/testmon/testmon_core.py index c677f07..d59efaf 100644 --- a/testmon/testmon_core.py +++ b/testmon/testmon_core.py @@ -109,7 +109,7 @@ def get_file(self, filename): code, checksum = read_file_with_checksum( os.path.join(self.rootdir, filename) ) - if code: + if checksum: fs_mtime = os.path.getmtime(os.path.join(self.rootdir, filename)) self.cache[filename] = Module( source_code=code,