Skip to content

Commit

Permalink
adjust test and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
klmcadams committed Dec 18, 2024
1 parent f49bd61 commit c74eec1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/ansys/mechanical/core/embedding/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ def _dispose(self):

def open(self, db_file, remove_lock=False):
"""Open the db file."""
# Remove the lock file if it exists before opening the project file
if remove_lock:
lock_file = Path(self.DataModel.Project.ProjectDirectory) / ".mech_lock"
if lock_file.exists():
Expand Down
10 changes: 2 additions & 8 deletions tests/embedding/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,9 @@ def test_app_lock_file_open(embedded_app, tmp_path: pytest.TempPathFactory):

lock_file = Path(embedded_app.DataModel.Project.ProjectDirectory) / ".mech_lock"

# Do not remove the lock file before opening the project file
embedded_app.open(project_file)

# Assert the lock file exists after opening it
# Assert the lock file exists after saving it
assert lock_file.exists()

# Assert a warning is emitted if the lock file is going to be removed
with pytest.warns(UserWarning):
# Remove the lock file before opening the project file
embedded_app.open(project_file, remove_lock=True)

# Assert the lock file has been removed
assert not lock_file.exists()

0 comments on commit c74eec1

Please sign in to comment.