Skip to content

Commit ad11863

Browse files
committed
remove some warnings on moving files to directories
1 parent 3aca411 commit ad11863

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

tests/test_other.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -2291,15 +2291,17 @@ def test_default_obj_ext(self):
22912291

22922292
self.clear()
22932293
os.mkdir(outdir)
2294-
process = Popen([PYTHON, EMCC, '-c', path_from_root('tests', 'hello_world.c'), '-o', outdir])
2295-
process.communicate()
2296-
assert(os.path.isfile(outdir + 'hello_world.o'))
2294+
process = Popen([PYTHON, EMCC, '-c', path_from_root('tests', 'hello_world.c'), '-o', outdir], stderr=PIPE)
2295+
out, err = process.communicate()
2296+
assert not err, err
2297+
assert os.path.isfile(outdir + 'hello_world.o')
22972298

22982299
self.clear()
22992300
os.mkdir(outdir)
2300-
process = Popen([PYTHON, EMCC, '-c', path_from_root('tests', 'hello_world.c'), '-o', outdir, '--default-obj-ext', 'obj'])
2301-
process.communicate()
2302-
assert(os.path.isfile(outdir + 'hello_world.obj'))
2301+
process = Popen([PYTHON, EMCC, '-c', path_from_root('tests', 'hello_world.c'), '-o', outdir, '--default-obj-ext', 'obj'], stderr=PIPE)
2302+
out, err = process.communicate()
2303+
assert not err, err
2304+
assert os.path.isfile(outdir + 'hello_world.obj')
23032305

23042306
def test_doublestart_bug(self):
23052307
open('code.cpp', 'w').write(r'''

tools/shared.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,11 @@ def unsuffixed_basename(name):
18361836
return os.path.basename(unsuffixed(name))
18371837

18381838
def safe_move(src, dst):
1839-
if os.path.abspath(src) == os.path.abspath(dst):
1839+
src = os.path.abspath(src)
1840+
dst = os.path.abspath(dst)
1841+
if os.path.isdir(dst):
1842+
dst = os.path.join(dst, os.path.basename(src))
1843+
if src == dst:
18401844
return
18411845
shutil.move(src, dst)
18421846

0 commit comments

Comments
 (0)