summaryrefslogtreecommitdiff
path: root/yoyo
diff options
context:
space:
mode:
authorOlly Cope <olly@ollycope.com>2022-08-29 14:47:44 +0000
committerOlly Cope <olly@ollycope.com>2022-08-29 14:47:44 +0000
commit3e81c59248e1a7baf30d1118ae3bcbf5625af970 (patch)
tree982ed9df1a0b8ae2ead3948281028111e12cf25d /yoyo
parent60ba14d1c572f1e1856795f7d16bbec8f115dea1 (diff)
downloadyoyo-3e81c59248e1a7baf30d1118ae3bcbf5625af970.tar.gz
tests: use freezegun instead of frozendate
Recent versions of pyparsing seem to break frozendate. freezegun works smoothly and is maintained.
Diffstat (limited to 'yoyo')
-rw-r--r--yoyo/tests/test_cli_script.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/yoyo/tests/test_cli_script.py b/yoyo/tests/test_cli_script.py
index 5670bce..09152aa 100644
--- a/yoyo/tests/test_cli_script.py
+++ b/yoyo/tests/test_cli_script.py
@@ -25,7 +25,7 @@ import sys
import textwrap
from mock import Mock, patch, call
-import frozendate
+import freezegun
import pytest
import tms
@@ -429,13 +429,9 @@ class TestNewMigration(TestInteractiveScript):
assert "__depends__ = {'m2', 'm3'}" in f.read()
def test_it_names_file_by_date_and_sequence(self, tmpdir):
- with frozendate.freeze(2001, 1, 1):
- main(
- ["new", "-b", "-m", "foo", str(tmpdir), "--database", dburi_sqlite3]
- )
- main(
- ["new", "-b", "-m", "bar", str(tmpdir), "--database", dburi_sqlite3]
- )
+ with freezegun.freeze_time("2001-1-1"):
+ main(["new", "-b", "-m", "foo", str(tmpdir), "--database", dburi_sqlite3])
+ main(["new", "-b", "-m", "bar", str(tmpdir), "--database", dburi_sqlite3])
names = [n for n in sorted(os.listdir(str(tmpdir))) if n.endswith(".py")]
assert names[0].startswith("20010101_01_")
assert names[0].endswith("-foo.py")
@@ -519,7 +515,7 @@ class TestNewMigration(TestInteractiveScript):
def test_it_calls_post_create_command(self, tmpdir):
self.writeconfig(post_create_command="/bin/ls -l {} {}")
- with frozendate.freeze(2001, 1, 1):
+ with freezegun.freeze_time("2001-1-1"):
main(["new", "-b", str(tmpdir), "--database", dburi_sqlite3])
is_filename = tms.Str(
lambda s: os.path.basename(s).startswith("20010101_01_")