Skip to content

Commit

Permalink
#145 Fix empty files causing testmon to crash
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Matlino committed Nov 27, 2019
1 parent be6c8af commit d3b8177
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",],
Expand Down
2 changes: 1 addition & 1 deletion testmon/testmon_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d3b8177

Please sign in to comment.