summaryrefslogtreecommitdiff
path: root/tests/pyscript/environment.py
blob: f1182c8292ed3cae2116545635a1b94a1dd2224d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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")