Skip to content
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

Fix notebook create on Windows #1996

Merged
merged 5 commits into from
Jan 17, 2025

Conversation

sfc-gh-pczajka
Copy link
Contributor

@sfc-gh-pczajka sfc-gh-pczajka commented Jan 16, 2025

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

Fix notebook stage path handling on Windows

@sfc-gh-pczajka sfc-gh-pczajka requested a review from a team as a code owner January 16, 2025 15:55
@sfc-gh-pczajka sfc-gh-pczajka marked this pull request as draft January 16, 2025 15:55
@@ -65,3 +65,30 @@ def test_create(mock_create, runner):
notebook_name=FQN.from_string("my_notebook"),
notebook_file=notebook_file,
)


@mock.patch("snowflake.connector.connect")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen we have this exact patch repeated around 100 times in the codebase - wdyt about extracting it to a fixture? Requesting that fixture would still be repetitive, but at least we would not have to worry about proper ordering of mocks/args. If you think it makes sense, I'd be happy to take it as a warmup :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In testing entites we use constants to define those paths, however they repeat in every test file.
So +1 for any effort to go through tests, and create conts in test utils dir, to call them in such situation

@sfc-gh-pczajka sfc-gh-pczajka marked this pull request as ready for review January 17, 2025 09:20
f"FROM '{stage_path}'\n"
"QUERY_WAREHOUSE = 'MockWarehouse'\n"
"MAIN_FILE = 'notebook.ipynb';\n"
"// Cannot use IDENTIFIER(...)\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment in query is intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I don't remember - @sfc-gh-turbaszek git blames you for that :D

@sfc-gh-pczajka sfc-gh-pczajka merged commit 2da6caf into main Jan 17, 2025
20 checks passed
@sfc-gh-pczajka sfc-gh-pczajka deleted the SNOW-1878046-fix-notebook-create-on-windows branch January 17, 2025 11:10
sfc-gh-pczajka added a commit that referenced this pull request Jan 17, 2025
* Add unit test

* test more cases

* fix stage path handling

* update release notes
sfc-gh-pczajka added a commit that referenced this pull request Jan 17, 2025
* Fix notebook create on Windows (#1996)

* Add unit test

* test more cases

* fix stage path handling

* update release notes

* SNOW-1875316: Merge current connection context with config to preserve command line params (#2000)

SNOW-1875316: Merge current connection context with config to preserve cmd line params

* Fix issue with list of accounts in release channels and directives (#1997)

* bump version

* snapshot update

---------

Co-authored-by: Marcin Raba <[email protected]>
Co-authored-by: Michel El Nacouzi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants