Skip to content

Commit

Permalink
Merge pull request #166 from 0Hughman0/migrate
Browse files Browse the repository at this point in the history
Removed redundant old migration code.
  • Loading branch information
0Hughman0 authored Aug 27, 2024
2 parents e03e4f8 + 3048811 commit f83901e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 109 deletions.
95 changes: 0 additions & 95 deletions cassini/migrate/V0_1toV0_2.py

This file was deleted.

11 changes: 3 additions & 8 deletions cassini/migrate/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
from cassini.utils import find_project

from .base import BaseMigrator
from .V0_1toV0_2 import V0_1toV0_2
from .V0_2toV0_3 import V0_2toV0_3


migrators = {("0.1", "0.2"): V0_1toV0_2, ("0.2", "0.3"): V0_2toV0_3}
migrators = {("0.2", "0.3"): V0_2toV0_3}


def main(args: List[str]) -> BaseMigrator:
Expand All @@ -19,12 +18,8 @@ def main(args: List[str]) -> BaseMigrator:
"It's not that fancy, so sequential updates may be needed."
)
)
parser.add_argument(
"old", choices=["0.1", "0.2"], help="which version to migrate from"
)
parser.add_argument(
"new", choices=["0.2", "0.3"], help="which version to migrate to"
)
parser.add_argument("old", choices=["0.2"], help="which version to migrate from")
parser.add_argument("new", choices=["0.3"], help="which version to migrate to")
parser.add_argument(
"--cassini-project",
default="project.py:project",
Expand Down
10 changes: 4 additions & 6 deletions tests/migrate/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from unittest.mock import Mock

from cassini.migrate.__main__ import main
from cassini.migrate.V0_1toV0_2 import V0_1toV0_2
from cassini.migrate.V0_2toV0_3 import V0_2toV0_3
from cassini import env

Expand All @@ -21,13 +20,12 @@ def mock_migrator(monkeypatch):


def test_migrate_selection(mock_migrator):
migrator = main(['0.1', '0.2'])

assert isinstance(migrator, V0_1toV0_2)

migrator = main(['0.2', '0.3'])

assert isinstance(migrator, V0_2toV0_3)

with pytest.raises(ValueError):
# A bit tricky to test...
"""
with pytest.raises(Exception):
migrator = main(['0.1', '0.3'])
"""

0 comments on commit f83901e

Please sign in to comment.