Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zodbtools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
zodbtools
Commits
574037c8
Commit
574037c8
authored
Jan 09, 2019
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XXX WIP fixed time
parent
2b6551cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
setup.py
setup.py
+1
-1
zodbtools/test/test_tidrange.py
zodbtools/test/test_tidrange.py
+16
-2
No files found.
setup.py
View file @
574037c8
...
...
@@ -23,7 +23,7 @@ setup(
install_requires
=
[
'ZODB'
,
'zodburi'
,
'zope.interface'
,
'pygolang >= 0.0.0.dev6'
,
'six'
,
'dateparser'
],
extras_require
=
{
'test'
:
[
'pytest'
],
'test'
:
[
'pytest'
,
'freezegun'
,
'pytz'
],
},
entry_points
=
{
'console_scripts'
:
[
'zodb = zodbtools.zodb:main'
]},
...
...
zodbtools/test/test_tidrange.py
View file @
574037c8
...
...
@@ -19,10 +19,13 @@
import
os
import
time
import
datetime
from
pytest
import
raises
,
fixture
from
zodbtools.util
import
parse_tidrange
,
TidRangeInvalid
,
ashex
import
pytz
from
freezegun
import
freeze_time
from
ZODB.TimeStamp
import
TimeStamp
from
zodbtools.util
import
parse_tidrange
,
TidRangeInvalid
@
fixture
def
europe_paris_timezone
():
...
...
@@ -38,6 +41,15 @@ def europe_paris_timezone():
time
.
tzset
()
@
fixture
def
fake_time_2001_01_01
():
"""Pytest's fixture to run this test as if now() was 2001/01/01 at midnight UTC.
"""
reference_time
=
datetime
.
datetime
(
2001
,
1
,
1
,
0
,
0
,
0
,
0
,
pytz
.
utc
)
with
freeze_time
(
reference_time
):
yield
def
test_tidrange_tid
():
assert
(
b"
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
xaa
\
xaa
"
,
...
...
@@ -59,7 +71,7 @@ def test_tidrange_tid():
assert
exc
.
value
.
args
==
(
"invalid"
,)
def
test_tidrange_date
(
europe_paris_timezone
):
def
test_tidrange_date
(
europe_paris_timezone
,
fake_time_2001_01_01
):
# dates in UTC
assert
(
b"
\
x03
\
xc4
\
x85
v
\
x00
\
x00
\
x00
\
x00
"
,
...
...
@@ -84,4 +96,6 @@ def test_tidrange_date(europe_paris_timezone):
)
==
parse_tidrange
(
"le 1er janvier 2018 à 10h30..2018年1月2日"
)
# or relative dates
assert
(
b"
\
x03
9
\
x8e
\
x7f
\
x00
\
x00
\
x00
\
x00
"
,
None
)
==
parse_tidrange
(
"1 minute ago.."
)
assert
(
None
,
None
)
!=
parse_tidrange
(
"1 month ago..yesterday"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment