Tigge / openant

ANT and ANT-FS Python Library
MIT License
174 stars 80 forks source link

Add tests for ant.fs.file.* #31

Closed Echelon9 closed 7 years ago

Echelon9 commented 7 years ago
coveralls commented 7 years ago

Coverage Status

Coverage increased (+2.1%) to 57.304% when pulling e4b02e431b86a88f8c6695b7b46dc3aeae70e1ce on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

Tigge commented 7 years ago

Is there anything that we can do to improve things with regards to timezones?

Echelon9 commented 7 years ago

There are options, but they involve bringing in extra dependencies for just the one test.

Tigge commented 7 years ago

Yeah that might be a bit unnecessary and I can't really remember if these ANT dates had a specified timezone or not now. How about just doing if sys.version_info >= (3,4)?

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.8%) to 56.999% when pulling d0c012e9d4481f04df26d549b49f7952cab96697 on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.8%) to 56.999% when pulling d0c012e9d4481f04df26d549b49f7952cab96697 on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.8%) to 56.999% when pulling d0c012e9d4481f04df26d549b49f7952cab96697 on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+2.3%) to 57.456% when pulling a08bfa6a2f3a4fb921edbe59d533327fbb47774d on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+2.3%) to 57.456% when pulling a08bfa6a2f3a4fb921edbe59d533327fbb47774d on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+2.3%) to 57.456% when pulling a08bfa6a2f3a4fb921edbe59d533327fbb47774d on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+2.3%) to 57.456% when pulling a08bfa6a2f3a4fb921edbe59d533327fbb47774d on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+2.3%) to 57.456% when pulling a08bfa6a2f3a4fb921edbe59d533327fbb47774d on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+2.3%) to 57.456% when pulling a08bfa6a2f3a4fb921edbe59d533327fbb47774d on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+2.3%) to 57.456% when pulling a08bfa6a2f3a4fb921edbe59d533327fbb47774d on Echelon9:test/fs/file into ed89281e37f65d768641e87356cef38877952397 on Tigge:master.

Echelon9 commented 7 years ago

Alright, so I think I've finally sorted the timezone issues as best as possible in a Python2.x and Python3.x manner, without resorting to additional external dependencies.

Fundamentally, without supplying timezone information at the point a datetime object is created (a 'naive' or 'unaware' `datetime object) there is little that can be done later to convert to a common timezone, as there's no reference point to shift off from.

Accordingly, within ant.fs.file.File() the UTC timezone is now set for the datetime object parsed off the device (an 'aware' datetime object).

See further:

Apologies from the coveralls spam whilst I got this working across Python 2.x to Python 3.x.

Tigge commented 7 years ago

Thank you, I'm really happy with this. Yeah, timezones are a mess, generally speaking and python could really be better at handling them -- but it is a hard topic to solve in a good way.