Author: Matti Picus <matti.pi...@gmail.com> Branch: Changeset: r93707:24a8129c7c62 Date: 2018-01-25 19:38 +0200 http://bitbucket.org/pypy/pypy/changeset/24a8129c7c62/
Log: fix some win32 rpython failures diff --git a/rpython/rlib/test/test_posix.py b/rpython/rlib/test/test_posix.py --- a/rpython/rlib/test/test_posix.py +++ b/rpython/rlib/test/test_posix.py @@ -34,7 +34,9 @@ func = self.interpret(fo,[fi]) stat = os.fstat(fi) for i in range(len(stat)): - assert long(getattr(func, 'item%d' % i)) == stat[i] + #on win32 python2, stat.st_dev is 0 + if stat[i] != 0: + assert long(getattr(func, 'item%d' % i)) == stat[i] def test_stat(self): diff --git a/rpython/rlib/test/test_rposix_scandir.py b/rpython/rlib/test/test_rposix_scandir.py --- a/rpython/rlib/test/test_rposix_scandir.py +++ b/rpython/rlib/test/test_rposix_scandir.py @@ -22,4 +22,4 @@ rposix_scandir.closedir(scan) found.remove('.') found.remove('..') - assert sorted(found) == sorted(os.listdir('/')) + assert sorted(found) == sorted(os.listdir(basedir)) diff --git a/rpython/rlib/test/test_runicode.py b/rpython/rlib/test/test_runicode.py --- a/rpython/rlib/test/test_runicode.py +++ b/rpython/rlib/test/test_runicode.py @@ -370,8 +370,11 @@ self.checkdecode(s, "utf-8") def test_utf8_surrogate(self): - # surrogates used to be allowed by python 2.x - py.test.raises(UnicodeDecodeError, self.checkdecode, u"\ud800", "utf-8") + # surrogates used to be allowed by python 2.x, and on narrow builds + if runicode.MAXUNICODE < 65536: + self.checkdecode(u"\ud800", "utf-8") + else: + py.test.raises(UnicodeDecodeError, self.checkdecode, u"\ud800", "utf-8") def test_invalid_start_byte(self): """ diff --git a/rpython/rlib/test/test_rurandom.py b/rpython/rlib/test/test_rurandom.py --- a/rpython/rlib/test/test_rurandom.py +++ b/rpython/rlib/test/test_rurandom.py @@ -1,3 +1,4 @@ +import py from rpython.rlib import rurandom def test_rurandom(): @@ -7,6 +8,7 @@ for x in [1, 11, 111, 222]: assert s.count(chr(x)) >= 1 +@py.test.mark.skipif("sys.platform == 'win32'") def test_rurandom_no_syscall(monkeypatch): monkeypatch.setattr(rurandom, 'SYS_getrandom', None) test_rurandom() diff --git a/rpython/translator/platform/test/test_makefile.py b/rpython/translator/platform/test/test_makefile.py --- a/rpython/translator/platform/test/test_makefile.py +++ b/rpython/translator/platform/test/test_makefile.py @@ -31,7 +31,7 @@ m.write(s) val = s.getvalue() assert not re.search('CC += +xxx', val, re.M) - assert re.search('CC += +yyy', val, re.M) + assert re.search('CC += +yyy', val, re.M) class TestMakefile(object): platform = host @@ -41,14 +41,14 @@ assert res.out == expected if self.strict_on_stderr: assert res.err == '' - assert res.returncode == 0 - + assert res.returncode == 0 + def test_900_files(self): tmpdir = udir.join('test_900_files').ensure(dir=1) txt = '#include <stdio.h>\n' for i in range(900): txt += 'int func%03d();\n' % i - txt += 'int main() {\n int j=0;' + txt += 'int main() {\n int j=0;' for i in range(900): txt += ' j += func%03d();\n' % i txt += ' printf("%d\\n", j);\n' @@ -100,8 +100,8 @@ for j in range(3000): txt += "int pcfunc%03d_%03d();\n" %(i, j) txt += '#endif' - pch_name.write(txt) - cfiles_precompiled_headers.append(pch_name) + pch_name.write(txt) + cfiles_precompiled_headers.append(pch_name) # Create some cfiles with headers we want precompiled cfiles = [] for i in range(ncfiles): @@ -111,11 +111,11 @@ txt += '#include "%s"\n' % pch_name txt += "int func%03d(){ return %d;};\n" % (i, i) c_name.write(txt) - cfiles.append(c_name) + cfiles.append(c_name) if sys.platform == 'win32': clean = ('clean', '', 'for %f in ( $(OBJECTS) $(TARGET) ) do @if exist %f del /f %f') get_time = time.clock - else: + else: clean = ('clean', '', 'rm -f $(OBJECTS) $(TARGET) ') get_time = time.time #write a non-precompiled header makefile @@ -138,7 +138,6 @@ t_precompiled = t1 - t0 res = self.platform.execute(mk.exe_name) self.check_res(res, '%d\n' %sum(range(ncfiles))) - print "precompiled haeder 'make' time %.2f, non-precompiled header time %.2f" %(t_precompiled, t_normal) - assert t_precompiled < t_normal * 0.5 + #print "precompiled haeder 'make' time %.2f, non-precompiled header time %.2f" %(t_precompiled, t_normal) + assert t_precompiled < t_normal - _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit