1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

Automatic release update warnings. (#1336)

* Hide pretty help

* Automatic release update warnings.

* `httpie cli check-updates`

* adapt to the new loglevel construct

* Don't make the pie-colors the bold

* Apply review feedback.

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
This commit is contained in:
Batuhan Taskaya
2022-05-05 21:18:20 +03:00
committed by GitHub
parent f9b5c2f696
commit 003f2095d4
21 changed files with 708 additions and 36 deletions

View File

@@ -49,6 +49,10 @@ HTTP_OK_COLOR = (
DUMMY_URL = 'http://this-should.never-resolve' # Note: URL never fetched
DUMMY_HOST = url_as_host(DUMMY_URL)
# We don't want hundreds of subprocesses trying to access GitHub API
# during the tests.
Config.DEFAULTS['disable_update_warnings'] = True
def strip_colors(colorized_msg: str) -> str:
return COLOR_RE.sub('', colorized_msg)
@@ -163,6 +167,7 @@ class MockEnvironment(Environment):
self._delete_config_dir = True
def cleanup(self):
self.devnull.close()
self.stdout.close()
self.stderr.close()
warnings.resetwarnings()
@@ -179,6 +184,11 @@ class MockEnvironment(Environment):
pass
class PersistentMockEnvironment(MockEnvironment):
def cleanup(self):
pass
class BaseCLIResponse:
"""
Represents the result of simulated `$ http' invocation via `http()`.
@@ -442,7 +452,4 @@ def http(
return r
finally:
devnull.close()
stdout.close()
stderr.close()
env.cleanup()