-
Notifications
You must be signed in to change notification settings - Fork 0
305 - replacing store with file #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please adapt to new behavior (using the scs location file, instead of the line magic).
Overwrite or mock get_scs_location_file_path() and then check if the file path was saved correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please review, i changed the logic to read from file
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this file can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think I should remove access_store_ui_app.py as well , because unused
| monkeypatch.setattr(access_ui, "get_scs_location_file_path", lambda: test_scs_file) | ||
|
|
||
| def test_access_store_ui_store_read_and_write(tmp_path): | ||
| mock_ipython = MagicMock() | ||
| with patch( | ||
| "exasol.nb_connector.ui.access_store_ui.get_ipython", return_value=mock_ipython | ||
| ): | ||
| # call UI | ||
| ui = get_access_store_ui(str(tmp_path)) | ||
| # assert "store -r" is called | ||
| mock_ipython.run_line_magic.assert_any_call("store", "-r") | ||
| # find open button | ||
| open_btn = next( | ||
| child | ||
| for child in ui.children | ||
| if isinstance(child, ipywidgets.Button) and child.description == "Open" | ||
| ) | ||
| # click open button | ||
| mock_ipython.run_line_magic.reset_mock() | ||
| open_btn.click() | ||
| # assert "store" is called | ||
| mock_ipython.run_line_magic.assert_any_call("store", "sb_store_file") | ||
| test_scs_file = tmp_path / "scs_file" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch order: Define first test_scs_file, then patch get_scs_location_file_path.
Makes readability of the code much easier....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe even define a fixture for test_scs_file
@pytest.fixture
def test_scs_file(tmp_path):
test_scs_file = tmp_path / "scs_file"
if test_scs_file.exists():
test_scs_file.unlink()
yield test_scs_file
test_scs_file.unlink()
def test_access_store_ui_store_read_and_write_2(tmp_path, test_scs_file, monkeypatch):
...
| @@ -0,0 +1,15 @@ | |||
| """ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we remove this file ?
ain't we ?



No description provided.