-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Bugfix/fix failing tests on windows due to relpath #8094
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
Changes from all commits
d8aa685
3675cf6
a1e8959
f3e45f6
fda258f
e403f60
151a4cb
0ae3860
1e4f5ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -459,7 +459,12 @@ def on_file(self, | |
type_map: Dict[Expression, Type], | ||
options: Options) -> None: | ||
self.last_xml = None | ||
path = os.path.relpath(tree.path) | ||
|
||
try: | ||
path = os.path.relpath(tree.path) | ||
except ValueError: | ||
return | ||
|
||
if should_skip_path(path): | ||
return | ||
|
||
|
@@ -813,7 +818,12 @@ def on_file(self, | |
modules: Dict[str, MypyFile], | ||
type_map: Dict[Expression, Type], | ||
options: Options) -> None: | ||
path = os.path.relpath(tree.path) | ||
|
||
try: | ||
path = os.path.relpath(tree.path) | ||
except ValueError: | ||
return | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the semantic reason for making the path relative? When I understand the code correctly a relative path outside of the directory where the code-under-check is in, should be ignored anyway (see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use relative paths since the paths could be included in the output and we want the output to be tidy and not depend on the current working directory. I agree that if we can't determine a relative path, we can just skip and return (both here and above). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I solved it by returning directly from the exception handler. Another alternative would be to mark the path as invalid (None or empty string for example) and skip then from the function |
||
if should_skip_path(path): | ||
return | ||
|
||
|
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.
By accident I saw that the original command did not work.