Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Georges Racinet
atd
Commits
215078565c2e
Commit
06b205bd
authored
Apr 24, 2013
by
Georges Racinet on ishtar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
General flake8 compliance
parent
a347bb7c288d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
14 deletions
+19
-14
anybox/testing/datetime/__init__.py
anybox/testing/datetime/__init__.py
+3
-1
anybox/testing/datetime/mock_dt.py
anybox/testing/datetime/mock_dt.py
+3
-2
anybox/testing/datetime/mock_time.py
anybox/testing/datetime/mock_time.py
+2
-1
anybox/testing/datetime/sqlite3.py
anybox/testing/datetime/sqlite3.py
+1
-0
setup.py
setup.py
+10
-10
No files found.
anybox/testing/datetime/__init__.py
View file @
21507856
...
...
@@ -4,4 +4,6 @@ sys.modules['datetime'] = mock_dt
import
mock_time
sys
.
modules
[
'time'
]
=
mock_time
from
.
import
sqlite3
# registering sqlite3 adapter/converters
from
.
import
sqlite3
# noqa
anybox/testing/datetime/mock_dt.py
View file @
21507856
from
datetime
import
*
# The current module will entirely substitute datetime, hence:
from
datetime
import
*
# noqa
from
datetime
import
datetime
as
original_datetime
class
ReplacementSubclassMeta
(
type
):
"""A metaclass for classes that subclass a given one to replace it.
...
...
@@ -60,4 +62,3 @@ class datetime(original_datetime):
of 'now'.
"""
cls
.
set_now
(
None
)
anybox/testing/datetime/mock_time.py
View file @
21507856
...
...
@@ -5,11 +5,12 @@ but not in subsequent imports from other modules.
Replacing the whole time module by this one does work.
"""
from
time
import
*
from
time
import
*
# noqa
from
time
import
time
as
original_time
from
datetime
import
datetime
def
time
():
if
datetime
.
_current_now
is
None
:
return
original_time
()
...
...
anybox/testing/datetime/sqlite3.py
View file @
21507856
...
...
@@ -34,6 +34,7 @@ from mock_dt import original_datetime
from
_sqlite3
import
register_adapter
def
adapt_datetime
(
val
):
return
val
.
isoformat
(
" "
)
...
...
setup.py
View file @
21507856
...
...
@@ -3,11 +3,12 @@ from setuptools import setup, find_packages
version
=
'0.4'
setup
(
name
=
"anybox.testing.datetime"
,
version
=
version
,
name
=
"anybox.testing.datetime"
,
version
=
version
,
author
=
"Georges Racinet"
,
author_email
=
"gracinet@anybox.fr"
,
description
=
"Various utilities related to date and time for testing purposes."
,
description
=
"Various utilities related to date and time for testing "
"purposes."
,
license
=
"GPLv3+"
,
long_description
=
open
(
'README.txt'
).
read
()
+
open
(
'CHANGES.txt'
).
read
(),
url
=
"https://bitbucket.org/anybox/anybox.testing.datetime"
,
...
...
@@ -15,12 +16,11 @@ setup(
zip_safe
=
False
,
include_package_data
=
True
,
namespace_packages
=
[
'anybox'
,
'anybox.testing'
],
install_requires
=
[
'setuptools'
,
],
install_requires
=
[
'setuptools'
],
classifiers
=
[
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)"
,
"License :: OSI Approved :: "
"GNU General Public License v3 or later (GPLv3+)"
,
"Topic :: Software Development :: Testing"
,
],
entry_points
=
{},
)
],
entry_points
=
{},
)
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