diff options
author | Olly Cope <olly@ollycope.com> | 2021-04-06 12:35:29 +0000 |
---|---|---|
committer | Olly Cope <olly@ollycope.com> | 2021-04-06 12:35:29 +0000 |
commit | bb0b0d812062589698165d68f78cdc44b13ac216 (patch) | |
tree | ff97e7fe11b92a26b586d100bf3f2c594e34bc51 | |
parent | 3dc51d7bdbefa8e80c02199b5dda8790a0f4b46d (diff) | |
download | yoyo-bb0b0d812062589698165d68f78cdc44b13ac216.tar.gz |
Fix mypy identified errors
-rw-r--r-- | yoyo/backends.py | 2 | ||||
-rw-r--r-- | yoyo/tests/test_cli_script.py | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/yoyo/backends.py b/yoyo/backends.py index 0946538..d9969df 100644 --- a/yoyo/backends.py +++ b/yoyo/backends.py @@ -159,7 +159,7 @@ class DatabaseBackend(object): _is_locked = False _in_transaction = False _internal_schema_updated = False - _transactional_ddl_cache: Dict[str, bool] = {} + _transactional_ddl_cache: Dict[bytes, bool] = {} def __init__(self, dburi, migration_table): self.uri = dburi diff --git a/yoyo/tests/test_cli_script.py b/yoyo/tests/test_cli_script.py index 3b6afe9..5670bce 100644 --- a/yoyo/tests/test_cli_script.py +++ b/yoyo/tests/test_cli_script.py @@ -182,7 +182,7 @@ class TestYoyoScript(TestInteractiveScript): def test_it_offers_to_upgrade(self, tmpdir): legacy_config_path = os.path.join(str(tmpdir), LEGACY_CONFIG_FILENAME) - with io.open(legacy_config_path, "w", encoding="utf-8") as f: + with open(legacy_config_path, "w", encoding="utf-8") as f: f.write("[DEFAULT]\n") f.write("migration_table=_yoyo_migration\n") f.write("dburi=sqlite:///\n") @@ -206,7 +206,7 @@ class TestYoyoScript(TestInteractiveScript): def test_it_upgrades_migration_table_None(self, tmpdir): legacy_config_path = os.path.join(str(tmpdir), LEGACY_CONFIG_FILENAME) - with io.open(legacy_config_path, "w", encoding="utf-8") as f: + with open(legacy_config_path, "w", encoding="utf-8") as f: f.write("[DEFAULT]\n") f.write("migration_table=None\n") f.write("dburi=sqlite:///\n") @@ -425,7 +425,7 @@ class TestNewMigration(TestInteractiveScript): ) as tmpdir: main(["new", "-b", "-m", "foo", tmpdir, "--database", dburi_sqlite3]) m = next(f for f in os.listdir(tmpdir) if "-foo.py" in f) - with io.open(os.path.join(tmpdir, m), encoding="utf-8") as f: + with open(os.path.join(tmpdir, m), encoding="utf-8") as f: assert "__depends__ = {'m2', 'm3'}" in f.read() def test_it_names_file_by_date_and_sequence(self, tmpdir): @@ -479,7 +479,7 @@ class TestNewMigration(TestInteractiveScript): def test_it_pulls_message_from_docstring(self, tmpdir): def write_migration(argv): - with io.open(argv[-1], "w", encoding="utf8") as f: + with open(argv[-1], "w", encoding="utf8") as f: f.write('"""\ntest docstring\nsplit over\n\nlines\n"""\n') self.subprocess.call = write_migration @@ -489,7 +489,7 @@ class TestNewMigration(TestInteractiveScript): def test_it_prompts_to_reedit_bad_migration(self, tmpdir): def write_migration(argv): - with io.open(argv[-1], "w", encoding="utf8") as f: + with open(argv[-1], "w", encoding="utf8") as f: f.write("this is not valid python!") self.subprocess.call = write_migration @@ -512,7 +512,7 @@ class TestNewMigration(TestInteractiveScript): ] ) names = [n for n in sorted(os.listdir(tmpdir)) if n.endswith(".py")] - with io.open( + with open( os.path.join(str(tmpdir), names[0]), "r", encoding="utf-8" ) as f: assert "your ad here" in f.read() @@ -549,7 +549,7 @@ class TestNewMigration(TestInteractiveScript): ] ) name = next(n for n in sorted(os.listdir(tmpdir)) if n.endswith(".sql")) - with io.open(os.path.join(tmpdir, name), "r", encoding="utf-8") as f: + with open(os.path.join(tmpdir, name), "r", encoding="utf-8") as f: assert f.read() == textwrap.dedent( """\ -- comment |