aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-05-09 11:24:13 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-05-09 11:24:13 -0700
commitad11863b6a26c4da4e500da165ea35e5a52c95b2 (patch)
tree0a7bbe1e2332383f6c9c91b4fcfa2f78f8f89d70
parent3aca411f788bf6db0e4eebacf4b8cf40076e11f6 (diff)
remove some warnings on moving files to directories
-rw-r--r--tests/test_other.py14
-rw-r--r--tools/shared.py6
2 files changed, 13 insertions, 7 deletions
diff --git a/tests/test_other.py b/tests/test_other.py
index 137a83b1..349a16b4 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -2291,15 +2291,17 @@ mergeInto(LibraryManager.library, {
self.clear()
os.mkdir(outdir)
- process = Popen([PYTHON, EMCC, '-c', path_from_root('tests', 'hello_world.c'), '-o', outdir])
- process.communicate()
- assert(os.path.isfile(outdir + 'hello_world.o'))
+ process = Popen([PYTHON, EMCC, '-c', path_from_root('tests', 'hello_world.c'), '-o', outdir], stderr=PIPE)
+ out, err = process.communicate()
+ assert not err, err
+ assert os.path.isfile(outdir + 'hello_world.o')
self.clear()
os.mkdir(outdir)
- process = Popen([PYTHON, EMCC, '-c', path_from_root('tests', 'hello_world.c'), '-o', outdir, '--default-obj-ext', 'obj'])
- process.communicate()
- assert(os.path.isfile(outdir + 'hello_world.obj'))
+ process = Popen([PYTHON, EMCC, '-c', path_from_root('tests', 'hello_world.c'), '-o', outdir, '--default-obj-ext', 'obj'], stderr=PIPE)
+ out, err = process.communicate()
+ assert not err, err
+ assert os.path.isfile(outdir + 'hello_world.obj')
def test_doublestart_bug(self):
open('code.cpp', 'w').write(r'''
diff --git a/tools/shared.py b/tools/shared.py
index 826baa83..5305d46b 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1836,7 +1836,11 @@ def unsuffixed_basename(name):
return os.path.basename(unsuffixed(name))
def safe_move(src, dst):
- if os.path.abspath(src) == os.path.abspath(dst):
+ src = os.path.abspath(src)
+ dst = os.path.abspath(dst)
+ if os.path.isdir(dst):
+ dst = os.path.join(dst, os.path.basename(src))
+ if src == dst:
return
shutil.move(src, dst)