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 auth tests for windows. #697

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ def wrapper(*args, **kwargs):
with pytest.raises(ValueError) as info:
func(*args, **kwargs)
exception_str = str(info.value)
exception_str = exception_str.replace(__tests__ + '/', '')
if platform.system() == 'Windows':
exception_str = exception_str.replace(__tests__ + '\\', '')
exception_str = exception_str.replace('\\', '/')
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a little bit weird since it means we will have to change all \ to / in test assertions, which is why I preferred customizing the message itself depending on the OS. Not a big deal though, as these test cases change rarely and only one has a \\ in the exception message now.

else:
exception_str = exception_str.replace(__tests__ + '/', '')
assert msg in exception_str

return wrapper
Expand Down
2 changes: 1 addition & 1 deletion tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_config_config_file(monkeypatch):

@raises(f"{default_auth_base_error_message}. Config: host=https://x")
def test_config_config_file_skip_default_profile_if_host_specified(monkeypatch):
monkeypatch.setenv('HOME', __tests__ + '/testdata')
set_home(monkeypatch, '/testdata')
cfg = Config(host='x')


Expand Down
Loading