Skip to content

Commit 02e37ac

Browse files
committed
Fix timestamp test in Python 3.6
Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
1 parent effbf56 commit 02e37ac

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

tests/case_file/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,11 @@ kb.ttl: \
9696
mv _$@ $@
9797

9898
sample.txt.done.log: \
99+
$(tests_srcdir)/.venv.done.log \
99100
sample_txt.py
100-
python3 sample_txt.py sample.txt
101+
source $(tests_srcdir)/venv/bin/activate \
102+
&& python3 sample_txt.py \
103+
sample.txt
101104
touch $@
102105

103106
# Display difference between rdflib default output and compacted output.

tests/case_file/sample_txt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
Mtime should be 2010-01-02T03:04:56Z.
1818
"""
1919

20-
import datetime
2120
import os
2221
import sys
2322

23+
import dateutil.parser
24+
2425
with open(sys.argv[1], "w") as out_fh:
2526
out_fh.write("test")
2627

27-
target_datetime = datetime.datetime.fromisoformat("2010-01-02T03:04:56+00:00")
28+
target_datetime = dateutil.parser.isoparse("2010-01-02T03:04:56+00:00")
2829
target_timestamp = target_datetime.timestamp()
2930
os.utime(sys.argv[1], (target_timestamp, target_timestamp))

tests/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
PyLD
22
pytest
3+
python-dateutil

0 commit comments

Comments
 (0)