File: getcwd_exec_test.py

package info (click to toggle)
cde 0.1%2Bgit9-g551e54d-1.1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,340 kB
  • ctags: 10,812
  • sloc: ansic: 75,881; sh: 4,282; python: 1,006; perl: 438; makefile: 297; lisp: 44; java: 5
file content (19 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# also, if you try to MOVE this test to another directory to re-run it,
# does it still work properly?
import os

# create an absolute path that's actually WITHIN our root dir
pwd = os.getcwd()
path = pwd + '/./hello.txt'

for line in open(path):
  print line,


# a harder test, go OUTSIDE of pwd with an ABSOLUTE PATH!!!
# TODO: currently this case does NOT work when you move across machines :(
path2 = pwd + '/../test_file.txt'

for line in open(path2):
  print line,