diff --git a/tests/files/nametest.FIT b/tests/files/nametest.FIT new file mode 100644 index 0000000..13cd333 Binary files /dev/null and b/tests/files/nametest.FIT differ diff --git a/tests/test.py b/tests/test.py index 8d36db7..2b97af8 100755 --- a/tests/test.py +++ b/tests/test.py @@ -399,15 +399,19 @@ def test_int_long(self): assert f.messages[-1].fields[1].raw_value == 1739.486328125 def test_fileish_types(self): - """Test the constructor does the right thing when given different types""" - with FitFile(testfile('Settings.FIT')): - pass - with FitFile(open(testfile("Settings.fit"), 'rb')): - pass - with FitFile(open(testfile("Settings.fit"), 'rb').read()): - pass - with FitFile(io.BytesIO(open(testfile("Settings.fit"), 'rb').read())): + """Test the constructor does the right thing when given different types + (specifically, test files with 8 characters, followed by an uppercase.FIT + extension), which confused the fileish check on Python 2, see + https://github.com/dtcooper/python-fitparse/issues/29#issuecomment-312436350 + for details""" + with FitFile(testfile('nametest.FIT')): pass + with open(testfile("nametest.FIT"), 'rb') as f: + FitFile(f) + with open(testfile("nametest.FIT"), 'rb') as f: + FitFile(f.read()) + with open(testfile("nametest.FIT"), 'rb') as f: + FitFile(io.BytesIO(f.read())) def test_elemnt_bolt_developer_data_id_without_application_id(self): """Test that a file without application id set inside developer_data_id is parsed