summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTodd Leonhardt <tleonhardt@gmail.com>2017-06-28 16:28:47 -0400
committerTodd Leonhardt <tleonhardt@gmail.com>2017-06-28 16:28:47 -0400
commit1931ce6013fff1804cf1658759eff80a64fb131a (patch)
tree24a81d52705e4054a77e070d4e26a962c3f77b9d /tests
parent6ea7fc0587ba1645ee4bdd4c610480e55c4a7d96 (diff)
downloadcmd2-git-1931ce6013fff1804cf1658759eff80a64fb131a.tar.gz
Simplified implementation of do__relative_load
Also removed default argument for _relative_load and load
Diffstat (limited to 'tests')
-rw-r--r--tests/relative_multiple.txt1
-rw-r--r--tests/script.txt1
-rw-r--r--tests/scripts/one_down.txt1
-rw-r--r--tests/test_cmd2.py9
4 files changed, 4 insertions, 8 deletions
diff --git a/tests/relative_multiple.txt b/tests/relative_multiple.txt
new file mode 100644
index 00000000..bbd11739
--- /dev/null
+++ b/tests/relative_multiple.txt
@@ -0,0 +1 @@
+_relative_load scripts/one_down.txt
diff --git a/tests/script.txt b/tests/script.txt
index 1e18262a..4dfe9677 100644
--- a/tests/script.txt
+++ b/tests/script.txt
@@ -1,2 +1 @@
-help
help history
diff --git a/tests/scripts/one_down.txt b/tests/scripts/one_down.txt
new file mode 100644
index 00000000..b87ff844
--- /dev/null
+++ b/tests/scripts/one_down.txt
@@ -0,0 +1 @@
+_relative_load ../script.txt
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index ba83e426..92fdaa14 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -283,18 +283,13 @@ load {}
assert out == expected
-def test_base_load_default_file(base_app, capsys):
- # TODO: Make sure to remove the 'command.txt' file in case it exists
-
+def test_base_load_with_empty_args(base_app, capsys):
# The way the load command works, we can't directly capture its stdout or stderr
run_cmd(base_app, 'load')
out, err = capsys.readouterr()
# The default file 'command.txt' doesn't exist, so we should get an error message
- expected = normalize("""ERROR: Problem accessing script from command.txt:
-[Errno 2] No such file or directory: 'command.txt'
-To enable full traceback, run the following command: 'set debug true'
-""")
+ expected = normalize("""ERROR: load command requires a file path:\n""")
assert normalize(str(err)) == expected