Skip to content

Commit

Permalink
test: fix flakyness with files order
Browse files Browse the repository at this point in the history
  • Loading branch information
browniebroke committed Oct 13, 2023
1 parent d218bed commit 4206edb
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test_remakemigrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def test_success_step_2_and_3(self):
json.dumps(
{
"testapp": [
["testapp", "0003_other_thing"],
["testapp", "0002_something"],
["testapp", "0001_initial"],
["testapp", "0002_something"],
["testapp", "0003_other_thing"],
]
}
)
Expand All @@ -81,8 +81,11 @@ def test_success_step_2_and_3(self):
assert err == ""
assert returncode == 0

dir_files = os.listdir(self.migrations_dir)
assert dir_files == ["__init__.py", "0001_initial.py"]
dir_files = sorted(os.listdir(self.migrations_dir))
assert dir_files == [
"0001_initial.py",
"__init__.py",
]

initial_0001 = self.migrations_dir / "0001_initial.py"
content = initial_0001.read_text()
Expand All @@ -98,12 +101,12 @@ def test_success_step_2_and_3(self):
assert err == ""
assert returncode == 0

dir_files = os.listdir(self.migrations_dir)
dir_files = sorted(os.listdir(self.migrations_dir))
today = datetime.today()
initial_remade_name = f"0001_remaked_{today:%Y%m%d}_initial.py"
assert dir_files == [
"__init__.py",
initial_remade_name,
"__init__.py",
]

initial_remade = self.migrations_dir / initial_remade_name
Expand Down

0 comments on commit 4206edb

Please sign in to comment.