Skip to content

Commit

Permalink
fix(gui.windows): improve test by isolating application repertories
Browse files Browse the repository at this point in the history
  • Loading branch information
maugde committed Sep 11, 2024
1 parent 6e42b8c commit 176dfd3
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions tests/integration/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,26 @@ def test_run__empty_target(self, downloaded_dir: Path, program_dir: Path, settin
"""
for source_dir in downloaded_dir.iterdir():
# Run the application
app = App(source_dir=source_dir, target_dir=program_dir, shortcut=False, launch=True)
# Make sure each application is installed in new directory
custom_dir = program_dir.joinpath(source_dir.name)
app = App(
source_dir=source_dir,
target_dir=custom_dir,
shortcut=False,
launch=True
)
try:
app.run()
except InstallError:
print("Server execution problem")
raise

# check if application was successfully installed in the target dir (program_dir)
assert program_dir.is_dir()
assert program_dir.iterdir()
assert custom_dir.is_dir()
assert custom_dir.iterdir()

# check if all files are identical in both source_dir (application_dir) and target_dir (program_dir)
program_dir_content = list(program_dir.iterdir())
program_dir_content = list(custom_dir.iterdir())
source_dir_content = list(source_dir.iterdir())
assert len(source_dir_content) == len(program_dir_content)
for index, file in enumerate(source_dir.iterdir()):
Expand All @@ -129,15 +136,6 @@ def test_run__empty_target(self, downloaded_dir: Path, program_dir: Path, settin
# give some time for the server to shut down
time.sleep(2)

# remove all files before installing the other versions
for file in program_dir.iterdir():
if file.is_dir():
shutil.rmtree(file)
else:
os.remove(file)
program_dir_content = list(program_dir.iterdir())
assert len(program_dir_content) == 0

def test_shortcut__created(self, downloaded_dir: Path, program_dir: Path, desktop_dir: Path, settings: Any):
for application_dir in downloaded_dir.iterdir():
# Run the application
Expand Down

0 comments on commit 176dfd3

Please sign in to comment.