From 014c400849f01582f958e1a729ce239ffd7b2268 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 20 Feb 2024 10:32:08 +0100 Subject: Merging upstream version 1.14.1. Signed-off-by: Daniel Baumann --- tests/cli_tests/test_config.py | 2 +- tests/cli_tests/test_history.py | 4 ++-- tests/cli_tests/test_pager.py | 4 ++-- tests/conftest.py | 2 +- tests/unittests/test_entry.py | 13 +++++++++++++ tests/unittests/test_utils.py | 1 + 6 files changed, 20 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/cli_tests/test_config.py b/tests/cli_tests/test_config.py index 1795c62..eeaba33 100644 --- a/tests/cli_tests/test_config.py +++ b/tests/cli_tests/test_config.py @@ -19,7 +19,7 @@ def test_log_location_config(): log = Path("/tmp/iredis1.log") assert log.exists() - with open(log, "r") as logfile: + with open(log) as logfile: content = logfile.read() assert len(content) > 100 diff --git a/tests/cli_tests/test_history.py b/tests/cli_tests/test_history.py index 09e6c82..acb25d3 100644 --- a/tests/cli_tests/test_history.py +++ b/tests/cli_tests/test_history.py @@ -10,7 +10,7 @@ def test_history_not_log_auth(cli): cli.sendline("set foo bar") cli.expect("OK") - with open(os.path.expanduser("~/.iredis_history"), "r") as history_file: + with open(os.path.expanduser("~/.iredis_history")) as history_file: content = history_file.read() assert "set foo bar" in content @@ -36,7 +36,7 @@ def test_history_create_and_writing_with_config(): log = Path("/tmp/iredis_history.txt") assert log.exists() - with open(log, "r") as logfile: + with open(log) as logfile: content = logfile.read() assert "set hello world" in content diff --git a/tests/cli_tests/test_pager.py b/tests/cli_tests/test_pager.py index c3f9fb0..e8106a4 100644 --- a/tests/cli_tests/test_pager.py +++ b/tests/cli_tests/test_pager.py @@ -13,12 +13,12 @@ TEST_IREDISRC = "/tmp/.iredisrc.test" TEST_PAGER_BOUNDARY = "---boundary---" TEST_PAGER_BOUNDARY_NUMBER = "---88938347271---" -env_pager = "{0} {1} {2}".format( +env_pager = "{} {} {}".format( sys.executable, os.path.join(pathlib.Path(__file__).parent, "wrappager.py"), TEST_PAGER_BOUNDARY, ) -env_pager_numbers = "{0} {1} {2}".format( +env_pager_numbers = "{} {} {}".format( sys.executable, os.path.join(pathlib.Path(__file__).parent, "wrappager.py"), TEST_PAGER_BOUNDARY_NUMBER, diff --git a/tests/conftest.py b/tests/conftest.py index 593e8a8..42840e3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -53,7 +53,7 @@ def judge_command(): return variables = m.variables() - print("Found variables: {}".format(variables)) + print(f"Found variables: {variables}") for expect_token, expect_value in expect.items(): all_variables = variables.getall(expect_token) if len(all_variables) > 1: diff --git a/tests/unittests/test_entry.py b/tests/unittests/test_entry.py index e53861e..99d6931 100644 --- a/tests/unittests/test_entry.py +++ b/tests/unittests/test_entry.py @@ -174,6 +174,19 @@ def test_command_shell_options_higher_priority(): verify_ssl=None, ), ), + ( + "redis://username:pass@word@localhost:12345/2", + DSN( + scheme="redis", + host="localhost", + port=12345, + path=None, + db=2, + username="username", + password="pass@word", + verify_ssl=None, + ), + ), ( "redis://username@localhost:12345", DSN( diff --git a/tests/unittests/test_utils.py b/tests/unittests/test_utils.py index 98ea8db..e00eaff 100644 --- a/tests/unittests/test_utils.py +++ b/tests/unittests/test_utils.py @@ -55,6 +55,7 @@ def test_timer(): (r'""', [""]), # set foo "" is a legal command (r"\\", ["\\\\"]), # backslash are legal ("\\hello\\", ["\\hello\\"]), # backslash are legal + ('foo "bar\\n1"', ["foo", "bar\n1"]), ], ) def test_stripe_quote_escape_in_quote(test_input, expected): -- cgit v1.2.3