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

test: fix unit tests to not overwrite existing cli config file #642

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ clean:
rm -rf dist linode_cli.egg-info build

.PHONY: testunit
testunit: export LINODE_CLI_TEST_MODE = 1
testunit:
pytest -v tests/unit
@mkdir -p /tmp/linode/.config
@orig_xdg_config_home=$${XDG_CONFIG_HOME:-}; \
export LINODE_CLI_TEST_MODE=1 XDG_CONFIG_HOME=/tmp/linode/.config; \
pytest -v tests/unit; \
export XDG_CONFIG_HOME=$$orig_xdg_config_home

.PHONY: testint
testint:
Expand Down
6 changes: 3 additions & 3 deletions linodecli/api_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ def _attempt_warn_old_version(ctx, result):
"with --suppress-warnings",
file=sys.stderr,
)
suppress_version_warning = ctx.config.get_bool("suppress-version-warning") or os.getenv(
"LINODE_CLI_SUPPRESS_VERSION_WARNING"
)
suppress_version_warning = ctx.config.get_bool(
"suppress-version-warning"
) or os.getenv("LINODE_CLI_SUPPRESS_VERSION_WARNING")
if new_version_exists and not suppress_version_warning:
print(
f"The API responded with version {spec_version}, which is newer than "
Expand Down
Loading