diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-17 11:39:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-17 11:39:50 -0500 |
commit | 729e152c525bc30d36f130f8dc8442aeb00d1de8 (patch) | |
tree | 25f9041650716c5be91926da39af0b0ebaca853f /tests/pyscript/environment.py | |
parent | 013b9e0a2c75e17f8aa0e0f7cbe50d84d2f657d8 (diff) | |
parent | 555db5d98fc122dc21d3bb239c079d68272cc0c3 (diff) | |
download | cmd2-git-729e152c525bc30d36f130f8dc8442aeb00d1de8.tar.gz |
Merge pull request #888 from python-cmd2/pyscript_fixes
pyscript fixes
Diffstat (limited to 'tests/pyscript/environment.py')
-rw-r--r-- | tests/pyscript/environment.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/pyscript/environment.py b/tests/pyscript/environment.py new file mode 100644 index 00000000..5e4d93d6 --- /dev/null +++ b/tests/pyscript/environment.py @@ -0,0 +1,20 @@ +# flake8: noqa F821 +# Tests that cmd2 populates __name__, __file__, and sets sys.path[0] to our directory +import os +import sys +app.cmd_echo = True + +if __name__ != '__main__': + print("Error: __name__ is: {}".format(__name__)) + quit() + +if __file__ != sys.argv[0]: + print("Error: __file__ is: {}".format(__file__)) + quit() + +our_dir = os.path.dirname(os.path.abspath(__file__)) +if our_dir != sys.path[0]: + print("Error: our_dir is: {}".format(our_dir)) + quit() + +print("PASSED") |