Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing issue for python 2.7 where timezone is - GMT and not + GMT #22

Merged
merged 4 commits into from
Jan 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pyclarity_lims/descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,11 @@ def _parse_element(self, element, lims, **kwargs):
except ValueError:
# support for python 2.7 ignore time zone
# use python 3 for timezone support
qt = qt.split('+')[0]
if '+' in qt:
qt = qt.split('+')[0]
else:
qt_array = qt.split('-')
qt = qt_array[0] + "-" + qt_array[1] + "-" + qt_array[2]
queue_date = datetime.datetime.strptime(qt, date_format)
list.append(self, (input_art, queue_date, location))

Expand Down
11 changes: 10 additions & 1 deletion tests/test_descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,13 @@ def setUp(self):
<value>A:2</value>
</location>
</artifact>
<artifact uri="{url}/artifacts/a3">
<queue-time>2011-12-25T01:10:10.050-00:00</queue-time>
<location>
<container uri="{url}/containers/c1"/>
<value>A:3</value>
</location>
</artifact>
</artifacts>
</test-entry>'''.format(url='http://testgenologics.com:4040/api/v2'))

Expand All @@ -776,10 +783,12 @@ def test_parse(self):
assert queued_artifacts[0] == qart
qart = self.get_queue_art('a2', 'A:2', 200000, datetime.timedelta(0, 3600))
assert queued_artifacts[1] == qart
qart = self.get_queue_art('a3', 'A:3', 50000, datetime.timedelta(0, 0))
assert queued_artifacts[2] == qart

def test_set(self):
queued_artifacts = QueuedArtifactList(self.instance1)
qart = self.get_queue_art('a1', 'A:3', 50000, datetime.timedelta(0, 0))
qart = self.get_queue_art('a1', 'A:4', 50000, datetime.timedelta(0, 0))
with pytest.raises(NotImplementedError):
queued_artifacts.append(qart)

Expand Down