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] get_cased_path doesn't raise when path does not exists #3516

Merged
merged 5 commits into from Sep 11, 2018

Conversation

@jgsogo
Copy link
Member

@jgsogo jgsogo commented Sep 10, 2018

Fix/improve implementation of get_cased_path: if you call it with a non-existing path, it will work only on the existing part of the path and leave the rest as is.

Changelog: Bugfix: get_cased_path crashed when the path didn't exist.

@ghost ghost assigned jgsogo Sep 10, 2018
@ghost ghost added the stage: review label Sep 10, 2018
p = get_cased_path(non_existing_path) # If not exists from the root, returns as is
self.assertEqual(p, non_existing_path)
except Exception as e:
self.fail("Unexpected exception: %s" % e)
Copy link
Member

@memsharded memsharded Sep 10, 2018

An uncontrolled exception will make the test fail anyway, don't use try-except

Copy link
Member Author

@jgsogo jgsogo Sep 10, 2018

I prefer having it explicit, but I can remove it... less lines of code ^^

Copy link
Member

@memsharded memsharded Sep 11, 2018

Yes, much better, thanks!

self.assertEqual(os.path.join(p1, "not-existing"),
get_cased_path(non_existing_path))
except Exception as e:
self.fail("Unexpected exception: %s" % e)
Copy link
Member

@memsharded memsharded Sep 10, 2018

Same as above

@jgsogo jgsogo assigned danimtb and unassigned jgsogo Sep 10, 2018
@memsharded memsharded added this to the 1.8 milestone Sep 11, 2018
@danimtb danimtb merged commit 56d84a9 into conan-io:develop Sep 11, 2018
2 checks passed
@ghost ghost removed the stage: review label Sep 11, 2018
grisumbras pushed a commit to grisumbras/conan that referenced this issue Dec 27, 2018
…o#3516)

* get_cased_path doesn't raise when path does not exists

* partially existing paths will be partially cased

* typo

* remove uneeded try-except blocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants