Skip to content

Commit

Permalink
fix: move directory creation to test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jbergstroem committed Dec 29, 2015
1 parent a239491 commit f96e027
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 0 additions & 8 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ function rmdirSync(p, originalEr) {
}

exports.refreshTmpDir = function() {
try {
fs.accessSync(testRoot, fs.W_OK);
} catch (e) {
if (e.code === 'ENOENT') {
process.exit(101);
}
}

rimrafSync(exports.tmpDir);
fs.mkdirSync(exports.tmpDir);
};
Expand Down
12 changes: 12 additions & 0 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,8 @@ def BuildOptions():
result.add_option("-r", "--run",
help="Divide the tests in m groups (interleaved) and run tests from group n (--run=n,m with n < m)",
default="")
result.add_option('--temp-dir',
help='Optional path to change directory used for tests', default=False)
return result


Expand Down Expand Up @@ -1546,6 +1548,16 @@ def Main():
for rule in globally_unused_rules:
print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path])

tempdir = os.environ.get('NODE_TEST_DIR') or options.temp_dir
if tempdir:
try:
os.makedirs(tempdir)
os.environ['NODE_TEST_DIR'] = tempdir
except OSError as exception:
if exception.errno != errno.EEXIST:
print "Could not create the temporary directory", options.temp_dir
sys.exit(1)

if options.report:
PrintReport(all_cases)

Expand Down

0 comments on commit f96e027

Please sign in to comment.