diff --git a/run-tests.sh b/run-tests.sh index 69b8a77..e3d2077 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -19,7 +19,10 @@ rm -rf /tmp/yamlpath-python-coverage-data rm -f .coverage for pythonVersion in "${@}"; do - which deactivate &>/dev/null && deactivate &>/dev/null + if which deactivate &>/dev/null; then + echo "Deactivating Python $(python --version). If this dumps you right back to the shell prompt, you were running Microsoft's VSCode-embedded Python and were just put into a sub-shell; just exit to resume tests." + deactivate + fi pyCommand=python${pythonVersion} if ! which "$pyCommand" &>/dev/null; then diff --git a/tests/conftest.py b/tests/conftest.py index 7734912..e931ef2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -96,7 +96,6 @@ def old_eyaml_keys(tmp_path_factory): return (old_private_key_file, old_public_key_file) -@requireseyaml @pytest.fixture(scope="session") def new_eyaml_keys(tmp_path_factory): """Creates temporary keys for encryption/decryption tests.""" diff --git a/tests/test_commands_eyaml_rotate_keys.py b/tests/test_commands_eyaml_rotate_keys.py index 56dc385..cab2656 100644 --- a/tests/test_commands_eyaml_rotate_keys.py +++ b/tests/test_commands_eyaml_rotate_keys.py @@ -12,20 +12,20 @@ class Test_eyaml_rotate_keys(): command = "eyaml-rotate-keys" def test_no_options(self, script_runner): - result = script_runner.run(self.command) + result = script_runner.run([self.command]) assert not result.success, result.stderr assert "usage: {}".format(self.command) in result.stderr def test_duplicate_keys(self, script_runner): bunk_key = "/does/not/exist/on-most/systems" - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(bunk_key), "--newpublickey={}".format(bunk_key), "--oldprivatekey={}".format(bunk_key), "--oldpublickey={}".format(bunk_key), bunk_key - ) + ]) assert not result.success, result.stderr assert "The new and old EYAML keys must be different." in result.stderr @@ -33,28 +33,28 @@ def test_bad_keys(self, script_runner): bunk_file = "/does/not/exist/on-most/systems" bunk_old_key = "/does/not/exist/on-most/systems/old" bunk_new_key = "/does/not/exist/on-most/systems/new" - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(bunk_new_key), "--newpublickey={}".format(bunk_new_key), "--oldprivatekey={}".format(bunk_old_key), "--oldpublickey={}".format(bunk_old_key), bunk_file - ) + ]) assert not result.success, result.stderr assert "EYAML key is not a readable file:" in result.stderr @requireseyaml def test_no_yaml_files(self, script_runner, old_eyaml_keys, new_eyaml_keys): bunk_file = "/does/not/exist/on-most/systems" - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(new_eyaml_keys[0]), "--newpublickey={}".format(new_eyaml_keys[1]), "--oldprivatekey={}".format(old_eyaml_keys[0]), "--oldpublickey={}".format(old_eyaml_keys[1]), bunk_file - ) + ]) assert not result.success, result.stderr assert "Not a file:" in result.stderr @@ -99,7 +99,7 @@ def test_good_multi_replacements(self, script_runner, tmp_path_factory, old_eyam simple_file = create_temp_yaml_file(tmp_path_factory, simple_content) anchored_file = create_temp_yaml_file(tmp_path_factory, anchored_content) - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(new_eyaml_keys[0]), "--newpublickey={}".format(new_eyaml_keys[1]), @@ -107,7 +107,7 @@ def test_good_multi_replacements(self, script_runner, tmp_path_factory, old_eyam "--oldpublickey={}".format(old_eyaml_keys[1]), simple_file, anchored_file - ) + ]) assert result.success, result.stderr with open(simple_file, 'r') as fhnd: @@ -171,38 +171,38 @@ def test_good_multi_replacements(self, script_runner, tmp_path_factory, old_eyam assert unwrap_node_coords(node) == 'This is a test value.' def test_yaml_parsing_error(self, script_runner, imparsible_yaml_file, old_eyaml_keys, new_eyaml_keys): - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(new_eyaml_keys[0]), "--newpublickey={}".format(new_eyaml_keys[1]), "--oldprivatekey={}".format(old_eyaml_keys[0]), "--oldpublickey={}".format(old_eyaml_keys[1]), imparsible_yaml_file - ) + ]) assert not result.success, result.stderr assert "YAML parsing error" in result.stderr def test_yaml_syntax_error(self, script_runner, badsyntax_yaml_file, old_eyaml_keys, new_eyaml_keys): - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(new_eyaml_keys[0]), "--newpublickey={}".format(new_eyaml_keys[1]), "--oldprivatekey={}".format(old_eyaml_keys[0]), "--oldpublickey={}".format(old_eyaml_keys[1]), badsyntax_yaml_file - ) + ]) assert not result.success, result.stderr assert "YAML syntax error" in result.stderr def test_yaml_composition_error(self, script_runner, badcmp_yaml_file, old_eyaml_keys, new_eyaml_keys): - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(new_eyaml_keys[0]), "--newpublickey={}".format(new_eyaml_keys[1]), "--oldprivatekey={}".format(old_eyaml_keys[0]), "--oldpublickey={}".format(old_eyaml_keys[1]), badcmp_yaml_file - ) + ]) assert not result.success, result.stderr assert "YAML composition error" in result.stderr @@ -213,14 +213,14 @@ def test_corrupted_eyaml_value(self, script_runner, tmp_path_factory, old_eyaml_ DBAEqBBAwcy7jvcOGcMfLEtugGVWWUnWq1DJ4Q==] """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(new_eyaml_keys[0]), "--newpublickey={}".format(new_eyaml_keys[1]), "--oldprivatekey={}".format(old_eyaml_keys[0]), "--oldpublickey={}".format(old_eyaml_keys[1]), yaml_file - ) + ]) assert not result.success, result.stderr assert "Unable to decrypt value!" in result.stderr @@ -239,14 +239,14 @@ def test_bad_recryption_key(self, script_runner, tmp_path_factory, old_eyaml_key NI/TSIF7M9U=] """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(new_eyaml_keys[1]), "--newpublickey={}".format(new_eyaml_keys[0]), "--oldprivatekey={}".format(old_eyaml_keys[0]), "--oldpublickey={}".format(old_eyaml_keys[1]), yaml_file - ) + ]) assert not result.success, result.stderr assert "unable to encrypt" in result.stderr or "cannot be run due to exit code: 1" in result.stderr @@ -267,7 +267,7 @@ def test_backup_file(self, script_runner, tmp_path_factory, old_eyaml_keys, new_ """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) backup_file = yaml_file + ".bak" - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(new_eyaml_keys[0]), "--newpublickey={}".format(new_eyaml_keys[1]), @@ -275,7 +275,7 @@ def test_backup_file(self, script_runner, tmp_path_factory, old_eyaml_keys, new_ "--oldpublickey={}".format(old_eyaml_keys[1]), "--backup", yaml_file - ) + ]) assert result.success, result.stderr assert os.path.isfile(backup_file) @@ -303,7 +303,7 @@ def test_replace_backup_file(self, script_runner, tmp_path_factory, old_eyaml_ke with open(backup_file, 'w') as fhnd: fhnd.write(content + "\nkey2: plain scalar string value") - result = script_runner.run( + result = script_runner.run([ self.command, "--newprivatekey={}".format(new_eyaml_keys[0]), "--newpublickey={}".format(new_eyaml_keys[1]), @@ -311,7 +311,7 @@ def test_replace_backup_file(self, script_runner, tmp_path_factory, old_eyaml_ke "--oldpublickey={}".format(old_eyaml_keys[1]), "--backup", yaml_file - ) + ]) assert result.success, result.stderr assert os.path.isfile(backup_file) diff --git a/tests/test_commands_yaml_diff.py b/tests/test_commands_yaml_diff.py index 24f30f3..55563af 100644 --- a/tests/test_commands_yaml_diff.py +++ b/tests/test_commands_yaml_diff.py @@ -218,43 +218,43 @@ class Test_commands_yaml_diff(): def test_no_options(self, script_runner): - result = script_runner.run(self.command) + result = script_runner.run([self.command]) assert not result.success, result.stderr assert "the following arguments are required: YAML_FILE" in result.stderr def test_too_many_pseudo_files(self, script_runner): - result = script_runner.run(self.command, "-", "-") + result = script_runner.run([self.command, "-", "-"]) assert not result.success, result.stderr assert "Only one YAML_FILE may be the - pseudo-file" in result.stderr def test_missing_first_input_file_arg(self, script_runner): - result = script_runner.run(self.command, "no-file.yaml", "no-file.yaml") + result = script_runner.run([self.command, "no-file.yaml", "no-file.yaml"]) assert not result.success, result.stderr assert "File not found" in result.stderr def test_missing_second_input_file_arg(self, script_runner, tmp_path_factory): lhs_file = create_temp_yaml_file(tmp_path_factory, self.lhs_hash_content) - result = script_runner.run(self.command, lhs_file, "no-file.yaml") + result = script_runner.run([self.command, lhs_file, "no-file.yaml"]) assert not result.success, result.stderr assert "File not found" in result.stderr def test_cannot_quiet_sameness(self, script_runner): - result = script_runner.run(self.command, "--quiet", "--same", "any-file.yaml", "any-other-file.json") + result = script_runner.run([self.command, "--quiet", "--same", "any-file.yaml", "any-other-file.json"]) assert not result.success, result.stderr assert "The --quiet|-q option suppresses all output, including" in result.stderr def test_missing_config_file(self, script_runner): - result = script_runner.run(self.command, "--config=/does/not/exist/on/most/systems.ini", "any-file.yaml", "any-other-file.json") + result = script_runner.run([self.command, "--config=/does/not/exist/on/most/systems.ini", "any-file.yaml", "any-other-file.json"]) assert not result.success, result.stderr assert "INI style configuration file is not readable" in result.stderr def test_missing_private_key(self, script_runner): - result = script_runner.run(self.command, "--privatekey=/does/not/exist/on/most/systems.key", "any-file.yaml", "any-other-file.json") + result = script_runner.run([self.command, "--privatekey=/does/not/exist/on/most/systems.key", "any-file.yaml", "any-other-file.json"]) assert not result.success, result.stderr assert "EYAML private key is not a readable file" in result.stderr def test_missing_public_key(self, script_runner): - result = script_runner.run(self.command, "--publickey=/does/not/exist/on/most/systems.key", "any-file.yaml", "any-other-file.json") + result = script_runner.run([self.command, "--publickey=/does/not/exist/on/most/systems.key", "any-file.yaml", "any-other-file.json"]) assert not result.success, result.stderr assert "EYAML public key is not a readable file" in result.stderr @@ -265,21 +265,21 @@ def test_bad_eyaml_value(self, script_runner, tmp_path_factory): ENC[PKCS7,MIIx...broken-on-purpose...==] """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--eyaml=/does/not/exist-on-most/systems", yaml_file, yaml_file - ) + ]) assert not result.success, result.stderr assert "No accessible eyaml command" in result.stderr def test_diff_yaml_parsing_error(self, script_runner, imparsible_yaml_file, badsyntax_yaml_file): - result = script_runner.run( + result = script_runner.run([ self.command, imparsible_yaml_file, badsyntax_yaml_file - ) + ]) assert not result.success, result.stderr assert "YAML parsing error" in result.stderr @@ -293,11 +293,11 @@ def test_multidoc_missing_lhs_index_error(self, script_runner, tmp_path_factory) """) rhs_file = create_temp_yaml_file(tmp_path_factory, self.lhs_hash_content) - result = script_runner.run( + result = script_runner.run([ self.command, lhs_file, rhs_file - ) + ]) assert not result.success, result.stderr assert "--left-document-index|-L must be set" in result.stderr @@ -311,11 +311,11 @@ def test_multidoc_missing_rhs_index_error(self, script_runner, tmp_path_factory) ... """) - result = script_runner.run( + result = script_runner.run([ self.command, lhs_file, rhs_file - ) + ]) assert not result.success, result.stderr assert "--right-document-index|-R must be set" in result.stderr @@ -329,11 +329,11 @@ def test_multidoc_index_too_high(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--left-document-index=1" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert "DOCUMENT_INDEX is too high" in result.stderr @@ -347,10 +347,10 @@ def test_no_diff_two_hash_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr assert "" == result.stdout @@ -364,10 +364,10 @@ def test_no_diff_two_aoh_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr assert "" == result.stdout @@ -469,11 +469,11 @@ def test_quiet_diff_two_hash_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--quiet" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert "" == result.stdout @@ -487,10 +487,10 @@ def test_simple_diff_two_hash_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert self.diff_hash_defaults == result.stdout @@ -519,10 +519,10 @@ def test_default_diff_two_aoh_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -551,11 +551,11 @@ def test_position_diff_two_aoh_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--aoh=position" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -579,11 +579,11 @@ def test_key_diff_two_aoh_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--aoh=key" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -634,11 +634,11 @@ def test_dpos_diff_two_aoh_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--aoh=dpos" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -652,11 +652,11 @@ def test_deep_diff_two_aoh_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--aoh=deep" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert self.diff_aoh_deep == result.stdout @@ -681,11 +681,11 @@ def test_value_diff_two_aoh_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--aoh=value" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1004,12 +1004,12 @@ def test_onlysame_diff_two_hash_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--onlysame" , "--aoh=deep" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1056,12 +1056,12 @@ def test_onlysame_deep_diff_two_aoh_files(self, script_runner, tmp_path_factory) # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--onlysame" , "--aoh=deep" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1148,10 +1148,10 @@ def test_diff_two_aliased_hash_files(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1196,12 +1196,12 @@ def test_simple_diff_two_hash_files_fslash(self, script_runner, tmp_path_factory # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--pathsep=/" , "--aoh=deep" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1293,12 +1293,12 @@ def test_diff_eyaml_allowed(self, script_runner, tmp_path_factory, old_eyaml_key # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--privatekey={}".format(old_eyaml_keys[0]) , "--publickey={}".format(old_eyaml_keys[1]) , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1394,11 +1394,11 @@ def test_diff_eyaml_disallowed(self, script_runner, tmp_path_factory, old_eyaml_ # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--ignore-eyaml-values" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1494,10 +1494,10 @@ def test_diff_two_multiline_string_hash_files(self, script_runner, tmp_path_fact # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1593,11 +1593,11 @@ def test_diff_two_multiline_string_hash_files_verbosely(self, script_runner, tmp # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--verbose" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1611,10 +1611,10 @@ def test_diff_array_by_default(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert self.diff_array_defaults == result.stdout @@ -1628,11 +1628,11 @@ def test_diff_array_by_position(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--arrays=position" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert self.diff_array_defaults == result.stdout @@ -1666,11 +1666,11 @@ def test_diff_array_by_value(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--arrays=value" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1694,10 +1694,10 @@ def test_diff_add_array_element(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1722,10 +1722,10 @@ def test_diff_add_aoh_element_default(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1754,11 +1754,11 @@ def test_diff_add_aoh_element_key(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--aoh=key" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1783,10 +1783,10 @@ def test_diff_delete_aoh_element_default(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1815,11 +1815,11 @@ def test_diff_delete_aoh_element_key(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--aoh=key" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -1851,11 +1851,11 @@ def test_diff_unkeyed_aoh_elements(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--aoh=key" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -2007,11 +2007,11 @@ def test_diff_custom_aoh_keyed_elements(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--config={}".format(config_file) , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -2119,10 +2119,10 @@ def test_comprehensive_tag_diffs(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert stdout_content == result.stdout @@ -2137,10 +2137,10 @@ def test_diff_set_normal(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(self.diff_set_defaults) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert self.diff_set_defaults == result.stdout @@ -2154,11 +2154,11 @@ def test_diff_set_verbose(self, script_runner, tmp_path_factory): # print("Expected Output:") # print(self.diff_set_defaults) - result = script_runner.run( + result = script_runner.run([ self.command , "--verbose" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert self.diff_set_verbose == result.stdout diff --git a/tests/test_commands_yaml_get.py b/tests/test_commands_yaml_get.py index aaedb66..2d6202d 100644 --- a/tests/test_commands_yaml_get.py +++ b/tests/test_commands_yaml_get.py @@ -8,17 +8,17 @@ class Test_yaml_get(): command = "yaml-get" def test_no_options(self, script_runner): - result = script_runner.run(self.command, "--nostdin") + result = script_runner.run([self.command, "--nostdin"]) assert not result.success, result.stderr assert "the following arguments are required: -p/--query" in result.stderr def test_no_input_file(self, script_runner): - result = script_runner.run(self.command, "--nostdin", "--query='/test'") + result = script_runner.run([self.command, "--nostdin", "--query='/test'"]) assert not result.success, result.stderr assert "YAML_FILE must be set or be read from STDIN" in result.stderr def test_bad_input_file(self, script_runner): - result = script_runner.run(self.command, "--query='/test'", "no-such-file") + result = script_runner.run([self.command, "--query='/test'", "no-such-file"]) assert not result.success, result.stderr assert "File not found:" in result.stderr @@ -27,7 +27,7 @@ def test_no_query(self, script_runner, tmp_path_factory): no: '' """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, yaml_file) + result = script_runner.run([self.command, yaml_file]) assert not result.success, result.stderr assert "the following arguments are required: -p/--query" in result.stderr @@ -36,7 +36,7 @@ def test_bad_privatekey(self, script_runner, tmp_path_factory): no: '' """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query=aliases", "--privatekey=no-such-file", yaml_file) + result = script_runner.run([self.command, "--query=aliases", "--privatekey=no-such-file", yaml_file]) assert not result.success, result.stderr assert "EYAML private key is not a readable file" in result.stderr @@ -45,22 +45,22 @@ def test_bad_publickey(self, script_runner, tmp_path_factory): no: '' """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query=aliases", "--publickey=no-such-file", yaml_file) + result = script_runner.run([self.command, "--query=aliases", "--publickey=no-such-file", yaml_file]) assert not result.success, result.stderr assert "EYAML public key is not a readable file" in result.stderr def test_yaml_parsing_error(self, script_runner, imparsible_yaml_file): - result = script_runner.run(self.command, "--query=/", imparsible_yaml_file) + result = script_runner.run([self.command, "--query=/", imparsible_yaml_file]) assert not result.success, result.stderr assert "YAML parsing error" in result.stderr def test_yaml_syntax_error(self, script_runner, badsyntax_yaml_file): - result = script_runner.run(self.command, "--query=/", badsyntax_yaml_file) + result = script_runner.run([self.command, "--query=/", badsyntax_yaml_file]) assert not result.success, result.stderr assert "YAML syntax error" in result.stderr def test_yaml_composition_error(self, script_runner, badcmp_yaml_file): - result = script_runner.run(self.command, "--query=/", badcmp_yaml_file) + result = script_runner.run([self.command, "--query=/", badcmp_yaml_file]) assert not result.success, result.stderr assert "YAML composition error" in result.stderr @@ -70,7 +70,7 @@ def test_bad_yaml_path(self, script_runner, tmp_path_factory): - &plainScalar Plain scalar string """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query=aliases[1]", yaml_file) + result = script_runner.run([self.command, "--query=aliases[1]", yaml_file]) assert not result.success, result.stderr assert "Required YAML Path does not match any nodes" in result.stderr @@ -81,12 +81,12 @@ def test_bad_eyaml_value(self, script_runner, tmp_path_factory): ENC[PKCS7,MIIx...broken-on-purpose...==] """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--query=aliases[&encryptedScalar]", "--eyaml=/does/not/exist-on-most/systems", yaml_file - ) + ]) assert not result.success, result.stderr assert "No accessible eyaml command" in result.stderr @@ -96,11 +96,11 @@ def test_recursive_yaml_anchor(self, script_runner, tmp_path_factory): recursive_key: *recursive_this """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--query=/hash", yaml_file - ) + ]) assert not result.success, result.stderr assert "contains an infinitely recursing" in result.stderr @@ -110,7 +110,7 @@ def test_query_anchor(self, script_runner, tmp_path_factory): - &plainScalar Plain scalar string """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query=aliases[&plainScalar]", yaml_file) + result = script_runner.run([self.command, "--query=aliases[&plainScalar]", yaml_file]) assert result.success, result.stderr assert "Plain scalar string" in result.stdout @@ -120,7 +120,7 @@ def test_query_list(self, script_runner, tmp_path_factory): - &plainScalar Plain scalar string """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query=aliases", yaml_file) + result = script_runner.run([self.command, "--query=aliases", yaml_file]) assert result.success, result.stderr assert '["Plain scalar string"]' in result.stdout @@ -169,7 +169,7 @@ def test_get_every_data_type(self, script_runner, tmp_path_factory): results = ["6", "6.8", "yes", "no", "True", "False", "\x00", "\x00", "", "null", "2022-09-23", "2022-09-24T14:13:12-07:30"] yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query=*", yaml_file) + result = script_runner.run([self.command, "--query=*", yaml_file]) assert result.success, result.stderr match_index = 0 @@ -200,7 +200,7 @@ def test_get_only_aoh_nodes_without_named_child(self, script_runner, tmp_path_fa ] yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query=/items/*[!has_child(bravo)]*", yaml_file) + result = script_runner.run([self.command, "--query=/items/*[!has_child(bravo)]*", yaml_file]) assert result.success, result.stderr match_index = 0 @@ -248,7 +248,7 @@ def test_get_only_aoh_nodes_with_named_child(self, script_runner, tmp_path_facto ] yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query=/products[has_child(recalled)]/name", yaml_file) + result = script_runner.run([self.command, "--query=/products[has_child(recalled)]/name", yaml_file]) assert result.success, result.stderr match_index = 0 @@ -290,7 +290,7 @@ def test_get_parent_nodes(self, script_runner, tmp_path_factory, query, output): """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query={}".format(query), yaml_file) + result = script_runner.run([self.command, "--query={}".format(query), yaml_file]) assert result.success, result.stderr match_index = 0 @@ -322,7 +322,7 @@ def test_get_node_names(self, script_runner, tmp_path_factory, query, output): """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query={}".format(query), yaml_file) + result = script_runner.run([self.command, "--query={}".format(query), yaml_file]) assert result.success, result.stderr match_index = 0 @@ -433,7 +433,7 @@ def test_get_min_max_nodes(self, script_runner, tmp_path_factory, query, output) """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, "--query={}".format(query), yaml_file) + result = script_runner.run([self.command, "--query={}".format(query), yaml_file]) assert result.success, result.stderr match_index = 0 diff --git a/tests/test_commands_yaml_merge.py b/tests/test_commands_yaml_merge.py index 60b0061..9c9409c 100644 --- a/tests/test_commands_yaml_merge.py +++ b/tests/test_commands_yaml_merge.py @@ -8,26 +8,26 @@ class Test_commands_yaml_merge(): command = "yaml-merge" def test_no_options(self, script_runner): - result = script_runner.run(self.command, "--nostdin") + result = script_runner.run([self.command, "--nostdin"]) assert not result.success, result.stderr assert "There must be at least one YAML_FILE" in result.stderr def test_missing_input_file_arg(self, script_runner): - result = script_runner.run(self.command, "--nostdin", "no-file.yaml") + result = script_runner.run([self.command, "--nostdin", "no-file.yaml"]) assert not result.success, result.stderr assert "Not a file" in result.stderr def test_missing_config_file(self, script_runner): - result = script_runner.run( + result = script_runner.run([ self.command , "--config=no-file.ini" , "lhs-file.yaml" - , "rhs-file.yaml") + , "rhs-file.yaml"]) assert not result.success, result.stderr assert "INI style configuration file is not readable" in result.stderr def test_nothing_to_backup(self, script_runner): - result = script_runner.run(self.command, "--nostdin", "--backup") + result = script_runner.run([self.command, "--nostdin", "--backup"]) assert not result.success, result.stderr assert "applies only to OVERWRITE file" in result.stderr @@ -37,19 +37,19 @@ def test_output_file_exists(self, script_runner, tmp_path_factory): """) output_file = create_temp_yaml_file(tmp_path_factory, merged_yaml) - result = script_runner.run( + result = script_runner.run([ self.command , "--output={}".format(output_file) , "lhs-file.yaml" - , "rhs-file.yaml") + , "rhs-file.yaml"]) assert not result.success, result.stderr assert "Output file already exists" in result.stderr def test_missing_prime_input_file(self, script_runner): - result = script_runner.run( + result = script_runner.run([ self.command , "no-file.yaml" - , "-") + , "-"]) assert not result.success, result.stderr assert "Not a file" in result.stderr @@ -60,10 +60,10 @@ def test_missing_rhs_input_file(self, script_runner, tmp_path_factory): merge_target: LHS original value """) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , "no-such-file.yaml") + , "no-such-file.yaml"]) assert not result.success, result.stderr assert "Not a file" in result.stderr @@ -75,11 +75,11 @@ def test_empty_rhs_input_file(self, script_runner, tmp_path_factory): """) rhs_file = create_temp_yaml_file(tmp_path_factory, "") - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr def test_merge_two_happy_files_to_stdout( @@ -108,11 +108,11 @@ def test_merge_two_happy_files_to_stdout( # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr assert merged_yaml_content == result.stdout @@ -145,12 +145,12 @@ def test_merge_two_happy_yaml_files_to_file(self, script_runner, tmp_path, tmp_p # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--output={}".format(output_file) , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -200,12 +200,12 @@ def test_merge_two_condense_all_multidoc_yaml_files_to_file(self, script_runner, # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--output={}".format(output_file) , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -260,13 +260,13 @@ def test_merge_two_across_multidoc_yaml_files_to_file(self, script_runner, tmp_p # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--output={}".format(output_file) , "--multi-doc-mode=merge_across" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -310,13 +310,13 @@ def test_merge_two_across_multidoc_yaml_files_to_file_json(self, script_runner, # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--output={}".format(output_file) , "--multi-doc-mode=merge_across" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -373,14 +373,14 @@ def test_merge_two_across_multidoc_yaml_files_to_file_json_indented(self, script # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--output={}".format(output_file) , "--multi-doc-mode=merge_across" , "--json-indent=4" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -424,13 +424,13 @@ def test_merge_two_across_multidoc_yaml_files_to_stdout_json(self, script_runner # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--multi-doc-mode=merge_across" , "--document-format=json" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr assert merged_yaml_content == result.stdout @@ -484,14 +484,14 @@ def test_merge_two_across_multidoc_yaml_files_to_stdout_json_indented(self, scri # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--multi-doc-mode=merge_across" , "--document-format=json" , "--json-indent=4" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr assert merged_yaml_content == result.stdout @@ -532,14 +532,14 @@ def test_merge_two_across_multidoc_yaml_files_to_stdout_json_nonindented(self, s # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--multi-doc-mode=merge_across" , "--document-format=json" , "--json-indent=-20" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr assert merged_yaml_content == result.stdout @@ -591,12 +591,12 @@ def test_merge_two_across_multidoc_yaml_files_to_stdout(self, script_runner, tmp # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--multi-doc-mode=merge_across" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr assert merged_yaml_content == result.stdout @@ -660,12 +660,12 @@ def test_merge_two_uneven_lhs_across_multidoc_yaml_files_to_stdout(self, script_ # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--multi-doc-mode=merge_across" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr assert merged_yaml_content == result.stdout @@ -724,12 +724,12 @@ def test_merge_two_uneven_rhs_across_multidoc_yaml_files_to_stdout(self, script_ # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--multi-doc-mode=merge_across" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr assert merged_yaml_content == result.stdout @@ -784,13 +784,13 @@ def test_merge_two_matrix_multidoc_yaml_files_to_file(self, script_runner, tmp_p # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--output={}".format(output_file) , "--multi-doc-mode=matrix_merge" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -825,13 +825,13 @@ def test_merge_two_happy_json_files_to_file(self, script_runner, tmp_path, tmp_p # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--output={}".format(output_file) , "--document-format=json" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -872,14 +872,14 @@ def test_merge_two_happy_json_files_to_file_indented(self, script_runner, tmp_pa # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--output={}".format(output_file) , "--document-format=json" , "--json-indent=4" , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -904,12 +904,12 @@ def test_convert_yaml_to_json_file(self, script_runner, tmp_path, tmp_path_facto # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--document-format=json" , "--output={}".format(output_file) - , lhs_file) + , lhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -939,13 +939,13 @@ def test_convert_yaml_to_json_file_indented(self, script_runner, tmp_path, tmp_p # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--document-format=json" , "--json-indent=4" , "--output={}".format(output_file) - , lhs_file) + , lhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -972,12 +972,12 @@ def test_convert_yaml_tagged_set_to_json_file(self, script_runner, tmp_path, tmp # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--document-format=json" , "--output={}".format(output_file) - , lhs_file) + , lhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -1010,13 +1010,13 @@ def test_convert_yaml_tagged_set_to_json_file_indented(self, script_runner, tmp_ # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--document-format=json" , "--json-indent=4" , "--output={}".format(output_file) - , lhs_file) + , lhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -1041,12 +1041,12 @@ def test_convert_json_to_yaml_file(self, script_runner, tmp_path, tmp_path_facto # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--document-format=yaml" , "--output={}".format(output_file) - , lhs_file) + , lhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -1064,10 +1064,10 @@ def test_bad_rhs_input_file(self, script_runner, tmp_path_factory): - two """) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr def test_bad_multidoc_lhs_input_file(self, script_runner, tmp_path_factory): @@ -1086,10 +1086,10 @@ def test_bad_multidoc_lhs_input_file(self, script_runner, tmp_path_factory): merge_target: LHS original value """) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr def test_bad_multidoc_rhs_input_file_condense_all(self, script_runner, tmp_path_factory): @@ -1108,10 +1108,10 @@ def test_bad_multidoc_rhs_input_file_condense_all(self, script_runner, tmp_path_ - two """) - result = script_runner.run( + result = script_runner.run([ self.command , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr def test_bad_multidoc_rhs_input_file_merge_across(self, script_runner, tmp_path_factory): @@ -1130,11 +1130,11 @@ def test_bad_multidoc_rhs_input_file_merge_across(self, script_runner, tmp_path_ - two """) - result = script_runner.run( + result = script_runner.run([ self.command , "--multi-doc-mode=merge_across" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr def test_bad_multidoc_rhs_input_file_matrix_merge(self, script_runner, tmp_path_factory): @@ -1153,11 +1153,11 @@ def test_bad_multidoc_rhs_input_file_matrix_merge(self, script_runner, tmp_path_ - two """) - result = script_runner.run( + result = script_runner.run([ self.command , "--multi-doc-mode=matrix_merge" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr def test_merge_explicit_from_stdin_to_stdout( @@ -1322,11 +1322,11 @@ def test_bad_mergeat_yamlpath_condense_all(self, script_runner, tmp_path_factory new_key: New value """) - result = script_runner.run( + result = script_runner.run([ self.command , "--mergeat=/[.~='']" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert "Unexpected use of \"~\" operator" in result.stderr @@ -1340,12 +1340,12 @@ def test_bad_mergeat_yamlpath_merge_across(self, script_runner, tmp_path_factory new_key: New value """) - result = script_runner.run( + result = script_runner.run([ self.command , "--mergeat=/[.~='']" , "--multi-doc-mode=merge_across" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert "Unexpected use of \"~\" operator" in result.stderr @@ -1359,12 +1359,12 @@ def test_bad_mergeat_yamlpath_matrix_merge(self, script_runner, tmp_path_factory new_key: New value """) - result = script_runner.run( + result = script_runner.run([ self.command , "--mergeat=/[.~='']" , "--multi-doc-mode=matrix_merge" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert "Unexpected use of \"~\" operator" in result.stderr @@ -1381,24 +1381,24 @@ def test_bad_lhs_multidoc_mergeat_yamlpath(self, script_runner, tmp_path_factory new_key: Override value """) - result = script_runner.run( + result = script_runner.run([ self.command , "--mergeat=/[.~='']" , lhs_file - , rhs_file) + , rhs_file]) assert not result.success, result.stderr assert "Unexpected use of \"~\" operator" in result.stderr def test_too_many_pseudofiles(self, script_runner): - result = script_runner.run( + result = script_runner.run([ self.command , '-' - , '-') + , '-']) assert not result.success, result.stderr assert "Only one YAML_FILE may be the - pseudo-file" in result.stderr def test_yaml_syntax_error(self, script_runner, badsyntax_yaml_file, old_eyaml_keys, new_eyaml_keys): - result = script_runner.run(self.command, badsyntax_yaml_file) + result = script_runner.run([self.command, badsyntax_yaml_file]) assert not result.success, result.stderr assert "YAML syntax error" in result.stderr @@ -1443,12 +1443,12 @@ def test_merge_yaml_output_json(self, script_runner, tmp_path, tmp_path_factory) # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--document-format=json" , "--output={}".format(output_file) - , lhs_file) + , lhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -1517,13 +1517,13 @@ def test_merge_yaml_output_json_indented(self, script_runner, tmp_path, tmp_path # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--document-format=json" , "--json-indent=4" , "--output={}".format(output_file) - , lhs_file) + , lhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -1593,12 +1593,12 @@ def test_merge_happy_multi_single_yaml_files_to_file(self, script_runner, tmp_pa # print("Expected Output:") # print(merged_yaml_content) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" , "--output={}".format(output_file) , lhs_file - , rhs_file) + , rhs_file]) assert result.success, result.stderr with open(output_file, 'r') as fhnd: @@ -1613,13 +1613,13 @@ def test_backup_file(self, script_runner, tmp_path_factory): """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) backup_file = yaml_file + ".bak" - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--overwrite={}".format(yaml_file), "--backup", yaml_file - ) + ]) assert result.success, result.stderr assert os.path.isfile(backup_file) @@ -1638,13 +1638,13 @@ def test_replace_backup_file(self, script_runner, tmp_path_factory): with open(backup_file, 'w') as fhnd: fhnd.write(content + "\nkey2: value2") - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--overwrite={}".format(yaml_file), "--backup", yaml_file - ) + ]) assert result.success, result.stderr assert os.path.isfile(backup_file) diff --git a/tests/test_commands_yaml_paths.py b/tests/test_commands_yaml_paths.py index d56798a..ff14e73 100644 --- a/tests/test_commands_yaml_paths.py +++ b/tests/test_commands_yaml_paths.py @@ -9,17 +9,17 @@ class Test_yaml_paths(): command = "yaml-paths" def test_no_options(self, script_runner): - result = script_runner.run(self.command, "--nostdin") + result = script_runner.run([self.command, "--nostdin"]) assert not result.success, result.stderr assert "the following arguments are required: -s/--search" in result.stderr def test_no_input_file(self, script_runner): - result = script_runner.run(self.command, "--nostdin", "--search=%abc") + result = script_runner.run([self.command, "--nostdin", "--search=%abc"]) assert not result.success, result.stderr assert "There must be at least one YAML_FILE or STDIN document" in result.stderr def test_bad_input_file(self, script_runner): - result = script_runner.run(self.command, "--search=%abc", "no-such-file") + result = script_runner.run([self.command, "--search=%abc", "no-such-file"]) assert not result.success, result.stderr assert "File not found:" in result.stderr @@ -28,28 +28,28 @@ def test_no_query(self, script_runner, tmp_path_factory): no: '' """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run(self.command, yaml_file) + result = script_runner.run([self.command, yaml_file]) assert not result.success, result.stderr assert "the following arguments are required: -s/--search" in result.stderr def test_yaml_parsing_error(self, script_runner, imparsible_yaml_file): - result = script_runner.run( + result = script_runner.run([ self.command, "--search=%abc", imparsible_yaml_file - ) + ]) assert not result.success, result.stderr assert "YAML parsing error" in result.stderr def test_yaml_syntax_error(self, script_runner, badsyntax_yaml_file): - result = script_runner.run( + result = script_runner.run([ self.command, "--search=%abc", badsyntax_yaml_file - ) + ]) assert not result.success, result.stderr assert "YAML syntax error" in result.stderr def test_yaml_composition_error(self, script_runner, badcmp_yaml_file): - result = script_runner.run( + result = script_runner.run([ self.command, "--search=%abc", badcmp_yaml_file - ) + ]) assert not result.success, result.stderr assert "YAML composition error" in result.stderr @@ -58,9 +58,9 @@ def test_bad_privatekey(self, script_runner, tmp_path_factory): no: '' """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--search=%abc", "--privatekey=no-such-file", yaml_file - ) + ]) assert not result.success, result.stderr assert "EYAML private key is not a readable file" in result.stderr @@ -69,9 +69,9 @@ def test_bad_publickey(self, script_runner, tmp_path_factory): no: '' """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--search=%abc", "--publickey=no-such-file", yaml_file - ) + ]) assert not result.success, result.stderr assert "EYAML public key is not a readable file" in result.stderr @@ -80,11 +80,11 @@ def test_simple_array_result(self, script_runner, tmp_path_factory): - element 1 """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--search", "^element", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/[0]", @@ -104,11 +104,11 @@ def test_simple_set_result(self, script_runner, tmp_path_factory): ? X """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--search", "$V", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/IV", @@ -127,11 +127,11 @@ def test_aliased_set_result(self, script_runner, tmp_path_factory): ? Ken Griffy """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--refnames", "--search", "^bl", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/aliases[&bl_anchor]", @@ -147,11 +147,11 @@ def test_nonrepeating_value_anchored_array(self, script_runner, tmp_path_factory - *anchor1 """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--search", "^element", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/aliases[&anchor1]", @@ -166,13 +166,13 @@ def test_nonrepeating_anchor_name_in_array(self, script_runner, tmp_path_factory - *anchor1 """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--refnames", "--search", "^anchor", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/aliases[&anchor1]" @@ -185,11 +185,11 @@ def test_nonrepeating_subarray(self, script_runner, tmp_path_factory): - subvalue """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--search", "=subvalue", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/array[0][0]", @@ -201,11 +201,11 @@ def test_simple_hash_result(self, script_runner, tmp_path_factory): child: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--search", "=value", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/parent/child", @@ -219,11 +219,11 @@ def test_ignore_aliases(self, script_runner, tmp_path_factory): child: *anchoredValue """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--search", "$alue", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/aliases[&anchoredValue]", @@ -238,12 +238,12 @@ def test_hash_merge_anchor(self, script_runner, tmp_path_factory): more: values """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--keynames", "--refnames", "--allowvaluealiases", "--search", "^anchored", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/anchored_hash", @@ -257,12 +257,12 @@ def test_anchored_hash_value(self, script_runner, tmp_path_factory): more: *anchoredValue """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--refnames", "--search", "^anchored", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/hash/key", @@ -278,12 +278,12 @@ def test_duplicate_hash_value_anchor(self, script_runner, tmp_path_factory): subchild1: *anchor """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--allowaliases", "--search", "^element", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/aliases[&anchor]", @@ -297,13 +297,13 @@ def test_simple_hash_anchor(self, script_runner, tmp_path_factory): child: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--refnames", "--keynames", "--search", "=anchored", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/parent", @@ -325,12 +325,12 @@ def test_hash_anchored_key(self, script_runner, tmp_path_factory): subval: 3.3 """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--onlykeynames", "--search", "=aliasOne", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/anchorKeys/aliasOne", @@ -353,14 +353,14 @@ def test_hash_nonduplicate_anchor_name_search(self, script_runner, tmp_path_fact subval: 3.3 """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--refnames", "--keynames", "--anchorsonly", "--search", "=recursiveAnchorKey", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/anchorKeys/subjectKey", @@ -382,12 +382,12 @@ def test_hash_duplicate_anchor_name_search(self, script_runner, tmp_path_factory subval: 3.3 """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--refnames", "--keynames", "--allowaliases", "--search", "=recursiveAnchorKey", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/anchorKeys/subjectKey", @@ -399,9 +399,9 @@ def test_empty_search_expression(self, script_runner, tmp_path_factory): no: '' """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--search==", yaml_file - ) + ]) assert not result.success, result.stderr assert "An EXPRESSION with only a search operator has no effect" in result.stderr @@ -410,9 +410,9 @@ def test_bad_expression(self, script_runner, tmp_path_factory): no: '' """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--search=abc", yaml_file - ) + ]) assert not result.success, result.stderr assert "Invalid search expression" in result.stderr @@ -421,9 +421,9 @@ def test_bad_yamlpath(self, script_runner, tmp_path_factory): no: '' """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--search", "=](.", yaml_file - ) + ]) assert not result.success, result.stderr assert "Invalid search expression" in result.stderr @@ -438,14 +438,14 @@ def test_multi_search_expressions(self, script_runner, tmp_path_factory): - bravo """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--keynames", "--search", "^value", "--search", "=bravo", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "[^value]: /[0]/value", @@ -464,13 +464,13 @@ def test_multi_file_single_expression_search(self, script_runner, tmp_path_facto """ yaml_file1 = create_temp_yaml_file(tmp_path_factory, content1) yaml_file2 = create_temp_yaml_file(tmp_path_factory, content2) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--pathsep=/", "--keynames", "--search", "^value", yaml_file1, yaml_file2 - ) + ]) assert result.success, result.stderr assert "\n".join([ "{}/0: /[0]/value".format(yaml_file1), @@ -491,14 +491,14 @@ def test_multi_file_multi_expression_search(self, script_runner, tmp_path_factor """ yaml_file1 = create_temp_yaml_file(tmp_path_factory, content1) yaml_file2 = create_temp_yaml_file(tmp_path_factory, content2) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--pathsep=/", "--keynames", "--search", "^value", "--search", "=bravo", yaml_file1, yaml_file2 - ) + ]) assert result.success, result.stderr assert "\n".join([ "{}/0[^value]: /[0]/value".format(yaml_file1), @@ -520,14 +520,14 @@ def test_multi_file_multi_expression_pathonly_search(self, script_runner, tmp_pa """ yaml_file1 = create_temp_yaml_file(tmp_path_factory, content1) yaml_file2 = create_temp_yaml_file(tmp_path_factory, content2) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--pathsep=/", "--keynames", "--noexpression", "--search", "^value", "--search", "=bravo", yaml_file1, yaml_file2 - ) + ]) assert result.success, result.stderr assert "\n".join([ "{}/0: /[0]/value".format(yaml_file1), @@ -558,7 +558,7 @@ def test_result_exclusions(self, script_runner, tmp_path_factory): display_name: What a pass! """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--onlykeynames", @@ -566,7 +566,7 @@ def test_result_exclusions(self, script_runner, tmp_path_factory): "--except", "%passthrough", "--except", "%display", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/accounts[0]/password", @@ -580,13 +580,13 @@ def test_empty_exclusion(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--pathsep=/", "--search==value", "--except==", yaml_file - ) + ]) assert not result.success, result.stderr assert "An EXPRESSION with only a search operator has no effect" in result.stderr assert "\n".join([ @@ -628,7 +628,7 @@ def test_search_encrypted_values(self, script_runner, tmp_path_factory, old_eyam 8OvCgBDvP5ZkrDJjHj6N5T8wSl/0] """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", @@ -637,7 +637,7 @@ def test_search_encrypted_values(self, script_runner, tmp_path_factory, old_eyam "--privatekey={}".format(old_eyaml_keys[0]), "--publickey={}".format(old_eyaml_keys[1]), yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/aliases[&doesMatch]", @@ -649,14 +649,14 @@ def test_dedupe_results(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--keynames", "--noexpression", "--search", "=key", "--search", "=value", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/key", @@ -673,14 +673,14 @@ def test_expand_map_parents(self, script_runner, tmp_path_factory): child2.1.1.1: value2.1.1.1 """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--expand", "--keynames", "--search", "^parent", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/parent1/child1.1", @@ -810,7 +810,7 @@ def test_expanded_keymatch_aliases(self, script_runner, tmp_path_factory, aliasm PATH: /usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", @@ -818,7 +818,7 @@ def test_expanded_keymatch_aliases(self, script_runner, tmp_path_factory, aliasm aliasmode, "--search", "=config", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join(assertions) + "\n" == result.stdout @@ -831,7 +831,7 @@ def test_expanded_key_refmatches(self, script_runner, tmp_path_factory): includeChild: static """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", @@ -839,7 +839,7 @@ def test_expanded_key_refmatches(self, script_runner, tmp_path_factory): "--refnames", "--allowkeyaliases", "--search", "=keyAnchor", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/anchors/key", @@ -852,7 +852,7 @@ def test_expanded_value_refmatches(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", @@ -860,7 +860,7 @@ def test_expanded_value_refmatches(self, script_runner, tmp_path_factory): "--refnames", "--search", "=thisHash", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/copy/key", @@ -874,14 +874,14 @@ def test_expand_sequence_parents(self, script_runner, tmp_path_factory): - value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--expand", "--refnames", "--search", "=list", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/&list[0][0][0]", @@ -978,14 +978,14 @@ def test_value_dump(self, script_runner, tmp_path_factory): - elements """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--pathsep=/", "--keynames", "--values", "--search", "^sample", yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join([ "/sample_scalar: value", @@ -1036,7 +1036,7 @@ def test_input_from_stdin_implicit(self, script_runner): assert stdout == result.stdout def test_too_many_stdins(self, script_runner): - result = script_runner.run(self.command, "--search", "=nothing", "-", "-") + result = script_runner.run([self.command, "--search", "=nothing", "-", "-"]) assert not result.success, result.stderr assert "Only one YAML_FILE may be the - pseudo-file" in result.stderr @@ -1080,7 +1080,7 @@ def test_unescaped_paths(self, script_runner, tmp_path_factory, pathsep, output) array2[]: bar """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--nostdin", "--nofile", "--expand", "--noescape", @@ -1088,6 +1088,6 @@ def test_unescaped_paths(self, script_runner, tmp_path_factory, pathsep, output) "--search", "=~/.*/", "--pathsep", str(pathsep), yaml_file - ) + ]) assert result.success, result.stderr assert "\n".join(output) + "\n" == result.stdout diff --git a/tests/test_commands_yaml_set.py b/tests/test_commands_yaml_set.py index 80b42c7..d2160b5 100644 --- a/tests/test_commands_yaml_set.py +++ b/tests/test_commands_yaml_set.py @@ -8,53 +8,53 @@ class Test_yaml_set(): command = "yaml-set" def test_no_options(self, script_runner): - result = script_runner.run(self.command) + result = script_runner.run([self.command]) assert not result.success, result.stderr assert "the following arguments are required: -g/--change" in result.stderr def test_no_input_file(self, script_runner): - result = script_runner.run(self.command, "--nostdin", "--change='/test'") + result = script_runner.run([self.command, "--nostdin", "--change='/test'"]) assert not result.success, result.stderr assert "There must be a YAML_FILE or STDIN document" in result.stderr def test_no_input_param(self, script_runner): - result = script_runner.run(self.command, "--change='/test'", "no-such-file") + result = script_runner.run([self.command, "--change='/test'", "no-such-file"]) assert not result.success, result.stderr assert "Exactly one of the following must be set:" in result.stderr def test_bad_yaml_file(self, script_runner): - result = script_runner.run(self.command, "--change='/test'", "--random=1", "no-such-file") + result = script_runner.run([self.command, "--change='/test'", "--random=1", "no-such-file"]) assert not result.success, result.stderr assert "File not found:" in result.stderr def test_identical_saveto_change_error(self, script_runner): - result = script_runner.run(self.command, "--change='/test'", "--random=1", "--saveto='/test'", "no-such-file") + result = script_runner.run([self.command, "--change='/test'", "--random=1", "--saveto='/test'", "no-such-file"]) assert not result.success, result.stderr assert "Impossible to save the old value to the same YAML Path as the new value!" in result.stderr def test_insufficient_randomness(self, script_runner): - result = script_runner.run(self.command, "--change='/test'", "--random=1", "--random-from=A", "no-such-file") + result = script_runner.run([self.command, "--change='/test'", "--random=1", "--random-from=A", "no-such-file"]) assert not result.success, result.stderr assert "The pool of random CHARS must have at least 2 characters" in result.stderr def test_bad_privatekey(self, script_runner): - result = script_runner.run(self.command, "--change='/test'", "--random=1", "--privatekey=no-such-file", "no-such-file") + result = script_runner.run([self.command, "--change='/test'", "--random=1", "--privatekey=no-such-file", "no-such-file"]) assert not result.success, result.stderr assert "EYAML private key is not a readable file" in result.stderr def test_bad_publickey(self, script_runner): - result = script_runner.run(self.command, "--change='/test'", "--random=1", "--publickey=no-such-file", "no-such-file") + result = script_runner.run([self.command, "--change='/test'", "--random=1", "--publickey=no-such-file", "no-such-file"]) assert not result.success, result.stderr assert "EYAML public key is not a readable file" in result.stderr def test_no_dual_stdin(self, script_runner): - result = script_runner.run(self.command, "--change='/test'", "--stdin", "-") + result = script_runner.run([self.command, "--change='/test'", "--stdin", "-"]) assert not result.success, result.stderr assert "Impossible to read both document and replacement value from STDIN" in result.stderr def test_no_backup_stdin(self, script_runner): - result = script_runner.run( - self.command, "--change='/test'", "--backup", "-") + result = script_runner.run([ + self.command, "--change='/test'", "--backup", "-"]) assert not result.success, result.stderr assert "applies only when reading from a file" in result.stderr @@ -62,9 +62,9 @@ def test_bad_data_type_optional(self, script_runner, tmp_path_factory): yaml_file = create_temp_yaml_file(tmp_path_factory, """--- boolean: false """) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/boolean", "--value=NOT_BOOLEAN", - "--format=boolean", yaml_file) + "--format=boolean", yaml_file]) assert not result.success, result.stderr assert "Impossible to write 'NOT_BOOLEAN' as boolean." in result.stderr @@ -72,9 +72,9 @@ def test_bad_data_type_mandatory(self, script_runner, tmp_path_factory): yaml_file = create_temp_yaml_file(tmp_path_factory, """--- boolean: false """) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/boolean", "--value=NOT_BOOLEAN", - "--format=boolean", "--mustexist", yaml_file) + "--format=boolean", "--mustexist", yaml_file]) assert not result.success, result.stderr assert "Impossible to write 'NOT_BOOLEAN' as boolean." in result.stderr @@ -85,8 +85,8 @@ def test_input_by_value(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( - self.command, "--change=/key", "--value=abc", yaml_file) + result = script_runner.run([ + self.command, "--change=/key", "--value=abc", yaml_file]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -123,12 +123,12 @@ def test_input_by_file(self, script_runner, tmp_path_factory): """ input_file = create_temp_yaml_file(tmp_path_factory, "abc\n") yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/key", "--file={}".format(input_file), yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -142,12 +142,12 @@ def test_input_by_random(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/key", "--random=50", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -155,17 +155,17 @@ def test_input_by_random(self, script_runner, tmp_path_factory): assert re.findall(r"^key:\s+[A-Za-z0-9]{50}$", filedat, re.M), filedat def test_yaml_parsing_error(self, script_runner, imparsible_yaml_file): - result = script_runner.run(self.command, "--change=/", "--random=1", imparsible_yaml_file) + result = script_runner.run([self.command, "--change=/", "--random=1", imparsible_yaml_file]) assert not result.success, result.stderr assert "YAML parsing error" in result.stderr def test_yaml_syntax_error(self, script_runner, badsyntax_yaml_file): - result = script_runner.run(self.command, "--change=/", "--random=1", badsyntax_yaml_file) + result = script_runner.run([self.command, "--change=/", "--random=1", badsyntax_yaml_file]) assert not result.success, result.stderr assert "YAML syntax error" in result.stderr def test_yaml_composition_error(self, script_runner, badcmp_yaml_file): - result = script_runner.run(self.command, "--change=/", "--random=1", badcmp_yaml_file) + result = script_runner.run([self.command, "--change=/", "--random=1", badcmp_yaml_file]) assert not result.success, result.stderr assert "YAML composition error" in result.stderr @@ -176,12 +176,12 @@ def test_bad_yaml_path(self, script_runner, tmp_path_factory): yaml_file = create_temp_yaml_file(tmp_path_factory, content) # Explicit --mustexist - result = script_runner.run(self.command, "--change=key2", "--random=1", "--mustexist", yaml_file) + result = script_runner.run([self.command, "--change=key2", "--random=1", "--mustexist", yaml_file]) assert not result.success, result.stderr assert "Required YAML Path does not match any nodes" in result.stderr # Implicit --mustexist via --saveto - result = script_runner.run(self.command, "--change=key3", "--random=1", "--saveto=save_here", yaml_file) + result = script_runner.run([self.command, "--change=key3", "--random=1", "--saveto=save_here", yaml_file]) assert not result.success, result.stderr assert "Required YAML Path does not match any nodes" in result.stderr @@ -190,13 +190,13 @@ def test_checked_replace(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/key", "--value=abc", "--check=value", yaml_file - ) + ]) assert result.success, result.stderr @requireseyaml @@ -205,25 +205,25 @@ def test_missing_key(self, script_runner, tmp_path_factory, old_eyaml_keys): encrypted: ENC[PKCS7,MIIx...blahblahblah...==] """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=encrypted", "--random=1", "--check=n/a", "--privatekey={}".format(old_eyaml_keys[0]), yaml_file - ) + ]) assert not result.success, result.stderr assert "Neither or both private and public EYAML keys must be set" in result.stderr - result = script_runner.run( + result = script_runner.run([ self.command, "--change=encrypted", "--random=1", "--check=n/a", "--publickey={}".format(old_eyaml_keys[1]), yaml_file - ) + ]) assert not result.success, result.stderr assert "Neither or both private and public EYAML keys must be set" in result.stderr @@ -233,7 +233,7 @@ def test_bad_decryption(self, script_runner, tmp_path_factory, old_eyaml_keys): encrypted: ENC[PKCS7,MIIx...broken-on-purpose...==] """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=encrypted", "--random=1", @@ -241,7 +241,7 @@ def test_bad_decryption(self, script_runner, tmp_path_factory, old_eyaml_keys): "--privatekey={}".format(old_eyaml_keys[0]), "--publickey={}".format(old_eyaml_keys[1]), yaml_file - ) + ]) assert not result.success, result.stderr assert "Unable to decrypt value!" in result.stderr @@ -250,13 +250,13 @@ def test_bad_value_check(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=key", "--random=1", "--check=abc", yaml_file - ) + ]) assert not result.success, result.stderr assert "does not match the check value" in result.stderr @@ -266,13 +266,13 @@ def test_cannot_save_multiple_matches(self, script_runner, tmp_path_factory): key2: value2 """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/[.^key]", "--random=1", "--saveto=/backup", yaml_file - ) + ]) assert not result.success, result.stderr assert "It is impossible to meaningly save more than one" in result.stderr @@ -283,13 +283,13 @@ def test_save_old_plain_value(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=key", "--value=new", "--saveto=backup", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -304,13 +304,13 @@ def test_save_old_crypt_value(self, script_runner, tmp_path_factory): ENC[PKCS7,MIIB...] """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=encrypted", "--value=now_plaintext", "--saveto=backup", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -322,12 +322,12 @@ def test_broken_change(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=[0]", "--random=1", yaml_file - ) + ]) assert not result.success, result.stderr assert "Cannot add" in result.stderr @@ -336,13 +336,13 @@ def test_broken_saveto(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=key", "--random=1", "--saveto=[2]", yaml_file - ) + ]) assert not result.success, result.stderr assert "Cannot add" in result.stderr @@ -357,7 +357,7 @@ def test_good_encryption(self, script_runner, tmp_path_factory, old_eyaml_keys): value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=key", "--value=now_encrypted", @@ -365,7 +365,7 @@ def test_good_encryption(self, script_runner, tmp_path_factory, old_eyaml_keys): "--privatekey={}".format(old_eyaml_keys[0]), "--publickey={}".format(old_eyaml_keys[1]), yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -378,7 +378,7 @@ def test_bad_crypt_path(self, script_runner, tmp_path_factory, old_eyaml_keys): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=[0]", "--random=1", @@ -386,7 +386,7 @@ def test_bad_crypt_path(self, script_runner, tmp_path_factory, old_eyaml_keys): "--privatekey={}".format(old_eyaml_keys[0]), "--publickey={}".format(old_eyaml_keys[1]), yaml_file - ) + ]) assert not result.success, result.stderr assert "Cannot add" in result.stderr @@ -395,14 +395,14 @@ def test_bad_eyaml_command(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=key", "--random=1", "--eyamlcrypt", "--eyaml=/does/not/exist/on-most/systems", yaml_file - ) + ]) assert not result.success, result.stderr assert "The eyaml binary is not executable" in result.stderr @@ -414,13 +414,13 @@ def test_backup_file(self, script_runner, tmp_path_factory): """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) backup_file = yaml_file + ".bak" - result = script_runner.run( + result = script_runner.run([ self.command, "--change=key", "--random=1", "--backup", yaml_file - ) + ]) assert result.success, result.stderr assert os.path.isfile(backup_file) @@ -439,13 +439,13 @@ def test_replace_backup_file(self, script_runner, tmp_path_factory): with open(backup_file, 'w') as fhnd: fhnd.write(content + "\nkey2: value2") - result = script_runner.run( + result = script_runner.run([ self.command, "--change=key", "--random=1", "--backup", yaml_file - ) + ]) assert result.success, result.stderr assert os.path.isfile(backup_file) @@ -475,12 +475,12 @@ def test_nonref_changes(self, script_runner, tmp_path_factory): me: set_value """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=otherstring.default.config.deploy.me", "--value=set_value", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -506,13 +506,13 @@ def test_commented_aliased_parent_hash(self, script_runner, tmp_path_factory): key: new value """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/hash/key", "--value=new value", "--backup", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -529,11 +529,11 @@ def test_set_value_in_empty_file( to: nowhere """ - result = script_runner.run( + result = script_runner.run([ self.command , "--change=some.key.to" , "--value=nowhere" - , yaml_file) + , yaml_file]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -546,11 +546,11 @@ def test_set_value_in_json_file( yaml_file = create_temp_yaml_file(tmp_path_factory, '{"key": "value"}') result_content = '{"key": "changed"}' - result = script_runner.run( + result = script_runner.run([ self.command , "--change=key" , "--value=changed" - , yaml_file) + , yaml_file]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -569,13 +569,13 @@ def test_set_value_in_json_file_nonindented( }""") result_content = """{"people": {"name": "John Doe", "age": 30, "state": {"name": "up"}}}""" - result = script_runner.run( + result = script_runner.run([ self.command , "--change=people.name" , "--value=John Doe" , "--json-indent=-4" , yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -602,13 +602,13 @@ def test_set_value_in_json_file_indented( } }""" - result = script_runner.run( + result = script_runner.run([ self.command , "--change=people.name" , "--value=John Doe" , "--json-indent=4" , yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -786,12 +786,12 @@ def test_delete_key(self, script_runner, tmp_path_factory): name: three """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/array", "--delete", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -857,12 +857,12 @@ def test_delete_from_collectors(self, script_runner, tmp_path_factory): name: three """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=(/array[0])+(/array_of_arrays[1])+(/array_of_hashes[2])", "--delete", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -928,12 +928,12 @@ def test_delete_from_nested_collectors(self, script_runner, tmp_path_factory): name: three """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=((/array[0])+(/array_of_arrays[1])+(/array_of_hashes[2]))", "--delete", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -999,12 +999,12 @@ def test_delete_from_too_too_nested_collectors(self, script_runner, tmp_path_fac name: three """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=(((/array[0])+(/array_of_arrays[1])+(/array_of_hashes[2])))", "--delete", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1016,12 +1016,12 @@ def test_refuse_delete_document(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, content) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/", "--delete", yaml_file - ) + ]) assert not result.success, result.stderr assert "Refusing to delete" in result.stderr @@ -1037,13 +1037,13 @@ def test_rename_anchor_explicit(self, script_runner, tmp_path_factory): key: *new_anchor """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=aliases[&old_anchor]", "--aliasof=aliases[&old_anchor]", "--anchor=new_anchor", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1062,12 +1062,12 @@ def test_rename_anchor_implicit_no_longer_possible(self, script_runner, tmp_path key: *new_anchor """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=aliases[&old_anchor]", "--anchor=new_anchor", yaml_file - ) + ]) assert not result.success, result.stderr assert "The --anchor|-H option may be used only when --aliasof|-A or --mergekey|-K are also set" in result.stderr @@ -1083,12 +1083,12 @@ def test_auto_anchor(self, script_runner, tmp_path_factory): a_key: *some_key """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=a_hash.a_key", "--aliasof=some_key", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1105,12 +1105,12 @@ def test_too_many_nodes_to_alias(self, script_runner, tmp_path_factory): aliased_key: *valid_anchor """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=hash.new_key", "--aliasof=aliases.*", yaml_file - ) + ]) assert not result.success, result.stderr assert "impossible to Alias more than one Anchor at a time" in result.stderr @@ -1122,13 +1122,13 @@ def test_auto_anchor_conflicted(self, script_runner, tmp_path_factory): a_key: A value """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=a_hash.a_key", "--aliasof=another_key", "--anchor=name_taken", yaml_file - ) + ]) assert not result.success, result.stderr assert "Anchor names must be unique within YAML documents" in result.stderr @@ -1148,12 +1148,12 @@ def test_auto_anchor_deconflicted(self, script_runner, tmp_path_factory): a_key: *some_key002 """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=a_hash.a_key", "--aliasof=some_key", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1172,12 +1172,12 @@ def test_reuse_anchor(self, script_runner, tmp_path_factory): a_key: *has_anchor """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=a_hash.a_key", "--aliasof=some_key", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1192,12 +1192,12 @@ def test_assign_docroot_tag(self, script_runner, tmp_path_factory): key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/", "--tag=!something", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1212,12 +1212,12 @@ def test_assign_anchorless_tag(self, script_runner, tmp_path_factory): key: !something value """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=key", "--tag=!something", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1236,12 +1236,12 @@ def test_assign_original_anchored_tag(self, script_runner, tmp_path_factory): key: *anchored_scalar """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=aliases[&anchored_scalar]", "--tag=!some_tag", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1260,12 +1260,12 @@ def test_assign_original_aliased_tag(self, script_runner, tmp_path_factory): key: *anchored_scalar """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=key", "--tag=some_tag", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1284,12 +1284,12 @@ def test_assign_null(self, script_runner, tmp_path_factory): egress_key: Following value """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=concrete_key", "--null", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1308,12 +1308,12 @@ def test_change_null(self, script_runner, tmp_path_factory): egress_key: Following value """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=concrete_key", "--value=Now not null", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1368,12 +1368,12 @@ def test_assign_to_nonexistent_nodes(self, script_runner, tmp_path_factory): platform: objective-c """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/devices/*[!has_child(os)]/os", "--value=generic", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1442,12 +1442,12 @@ def test_yaml_merge_keys_delete(self, script_runner, tmp_path_factory): platform: objective-c """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/devices/*/&device_defaults", "--delete", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1462,12 +1462,12 @@ def test_change_key_name_good(self, script_runner, tmp_path_factory): renamed_key: value """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/key[name()]", "--value=renamed_key", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1482,12 +1482,12 @@ def test_change_key_name_maps_only(self, script_runner, tmp_path_factory): """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=/items[0][name()]", "--value=2", yaml_file - ) + ]) assert not result.success, result.stdout assert "Keys can be renamed only in Hash/map/dict" in result.stderr @@ -1498,12 +1498,12 @@ def test_change_key_name_unique_only(self, script_runner, tmp_path_factory): """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=another_key[name()]", "--value=key", yaml_file - ) + ]) assert not result.success, result.stdout assert "already exists at the same document level" in result.stderr @@ -1573,12 +1573,12 @@ def test_set_ymk(self, script_runner, tmp_path_factory): platform: objective-c """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=devices.*", "--mergekey=&device_defaults", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: @@ -1595,12 +1595,12 @@ def test_too_many_nodes_to_ymk(self, script_runner, tmp_path_factory): aliased_key: *valid_anchor """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=hash", "--mergekey=aliases.*", yaml_file - ) + ]) assert not result.success, result.stderr assert "impossible to Alias more than one Anchor at a time" in result.stderr @@ -1614,12 +1614,12 @@ def test_cannot_ymk_non_hashes(self, script_runner, tmp_path_factory): aliased_key: *valid_anchor """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=hash.concrete_key", "--mergekey=&all_aliases", yaml_file - ) + ]) assert not result.success, result.stderr assert "Cannot add YAML Merge Keys to non-Hash" in result.stderr @@ -1643,12 +1643,12 @@ def test_ymk_anchor_child_format_change(self, script_runner, tmp_path_factory): <<: *base """ yaml_file = create_temp_yaml_file(tmp_path_factory, yamlin) - result = script_runner.run( + result = script_runner.run([ self.command, "--change=common.TEST_COMMON_SETTING", "--value=a2", yaml_file - ) + ]) assert result.success, result.stderr with open(yaml_file, 'r') as fhnd: diff --git a/tests/test_commands_yaml_validate.py b/tests/test_commands_yaml_validate.py index 6bedba8..ae260aa 100644 --- a/tests/test_commands_yaml_validate.py +++ b/tests/test_commands_yaml_validate.py @@ -8,15 +8,15 @@ class Test_commands_yaml_validate(): command = "yaml-validate" def test_no_arguments(self, script_runner): - result = script_runner.run(self.command, "--nostdin") + result = script_runner.run([self.command, "--nostdin"]) assert not result.success, result.stderr assert "There must be at least one YAML_FILE" in result.stderr def test_too_many_pseudofiles(self, script_runner): - result = script_runner.run( + result = script_runner.run([ self.command , '-' - , '-') + , '-']) assert not result.success, result.stderr assert "Only one YAML_FILE may be the - pseudo-file" in result.stderr @@ -26,18 +26,18 @@ def test_valid_singledoc(self, script_runner, tmp_path_factory): single-document: is: valid """) - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" - , yaml_file) + , yaml_file]) assert result.success, result.stderr def test_invalid_singledoc(self, script_runner, tmp_path_factory): yaml_file = create_temp_yaml_file(tmp_path_factory, "{[}") - result = script_runner.run( + result = script_runner.run([ self.command , "--nostdin" - , yaml_file) + , yaml_file]) assert not result.success, result.stderr assert " * YAML parsing error in" in result.stdout diff --git a/tests/test_eyaml_eyamlprocessor.py b/tests/test_eyaml_eyamlprocessor.py index 150749d..9dd4d6f 100644 --- a/tests/test_eyaml_eyamlprocessor.py +++ b/tests/test_eyaml_eyamlprocessor.py @@ -14,7 +14,6 @@ from tests.conftest import requireseyaml, quiet_logger, old_eyaml_keys -@requireseyaml @pytest.fixture def eyamldata_f(): data = """---