File: abs_workdir.py

package info (click to toggle)
boost1.83 1.83.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 545,632 kB
  • sloc: cpp: 3,857,086; xml: 125,552; ansic: 34,414; python: 25,887; asm: 5,276; sh: 4,799; ada: 1,681; makefile: 1,629; perl: 1,212; pascal: 1,139; sql: 810; yacc: 478; ruby: 102; lisp: 24; csh: 6
file content (39 lines) | stat: -rw-r--r-- 1,188 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Niklaus Giger, 2005-03-15
# Testing whether we may run a test in absolute directories. There are no tests
# for temporary directories as this is implictly tested in a lot of other cases.

# TODO: Move to a separate testing-system test group.

import BoostBuild
import os
import tempfile

# Python 2.7 does not implement os.path.samefile on Windows
import ntpath
if not hasattr(ntpath, "samefile"):
    def samefile(f1, f2):
        try:
            from os.path.nt import _getfinalpathname
            return os.path._getfinalpathname(f1) == os.path._getfinalpathname(f2)
        except (NotImplementedError, ImportError):
            return os.path.abspath(f1) == os.path.abspath(f2)

    ntpath.samefile = samefile

t = BoostBuild.Tester(["-ffile.jam"], workdir=os.getcwd(), pass_d0=False,
    pass_toolset=False)

t.write("file.jam", "EXIT [ PWD ] : 0 ;")

t.run_build_system()
t.fail_test(not os.path.samefile(t.stdout().rstrip("\n"), os.getcwd()))

try:
    t.run_build_system(status=123, subdir="/must/fail/with/absolute/path",
        stderr=None)
except ValueError as e:
    assert "subdir" in str(e), e
else:
    raise ValueError("exception expected")
finally:
    t.cleanup()