-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: setup now sets migrations dir as relative path when possible #4439
base: master
Are you sure you want to change the base?
fix: setup now sets migrations dir as relative path when possible #4439
Conversation
I do not know where macos differs when it comes to the second test I have included. Since I do not have the means to run tests on macos, and I do not wish to pollute this PR with hypothese-commits on what could be the fix, I'd appreciate if someone can enlighten me :) |
Thanks for opening this PR. These errors look strange. Unfortunately I do not have access to any other macos machine than the CI runners and I cannot reproduce the issue locally so its hard for me to tell what's wrong here. |
On MacOS, the project directory (created by tempdir), is in /var/folders/... This /var directory is a symlink to /private/var In the function create_config_file(), the 'current_path' parameter used in the function convert_absolute_path_to_relative() is defined by calling find_project_root() which return a path in /private/var/... In the test "setup_writes_migration_dir_as_relative_path", when the function convert_absolute_path_to_relative() is called, target_path and current_path are both in /private/var and everything is fine the test "setup_writes_migration_dir_as_arg_as_relative_path" uses p.directory(), which return a path in /var So when the function convert_absolute_path_to_relative() is called, target_path is in /var/ but current_path is in /private/var The result of this is that the diesel.toml file generated contains : dir = "../../../../../../../var/folders/by/lfy0tf8939qflt_lsmzt0mzr0000gn/T/setup_writes_migration_dir_as_arg_as_relative_pathMYasaL/foo" and that value is not what we expect ;) So, I added a call to canonicalize() after p.directory_path() so that the path is resolved to /private/var/... => the tests pass
@the-solid-box, I submitted a PR on your repo to fix the tests on MacOS |
…th-mac fix tests on MacOS
Merged, let's see if the CI still complains! |
Well, looks like windows isn't liking it now... Luckily I do have a windows machine, I'll have a look when I can. Might just write two tests, one for macos, one for windows and linux. Thanks for the help @gcavelier |
fixes #4436