Commits

holger krekel committed 609cbbc Merge

merge ronny's branch

Comments (0)

Files changed (5)

 import py
 
-from pytest.plugin.pytest_restdoc import convert_rest_html, strip_html_header
+from pytest.plugin.restdoc import convert_rest_html, strip_html_header
 
 html = py.xml.html
 
         'reversed'       : '._builtin:reversed',
         'sorted'         : '._builtin:sorted',
         'any'            : '._builtin:any',
+        'all'            : '._builtin:all',
         'set'            : '._builtin:set',
         'frozenset'      : '._builtin:frozenset',
         'BaseException'  : '._builtin:BaseException',
         return False
 
 try:
+    all = all
+except NameError:
+    def all(iterable):
+        for x in iterable:
+            if not x:
+                return False
+        return True
+
+try:
     sorted = sorted
 except NameError:
     builtin_cmp = cmp # need to use cmp as keyword arg

testing/root/test_builtin.py

     assert not py.builtin.any([0,False, None])
     assert py.builtin.any([0,False, None,1])
 
+def test_all():
+    assert not py.builtin.all([True, 1, False])
+    assert py.builtin.all([True, 1, object])
+
 def test_BaseException():
     assert issubclass(IndexError, py.builtin.BaseException)
     assert issubclass(Exception, py.builtin.BaseException)

testing/test_apipkg.py

 
 @py.test.mark.multi(mode=['attr', 'dict', 'onfirst'])
 def test_onfirstaccess_setsnewattr(tmpdir, monkeypatch, mode):
-    pkgname = tmpdir.basename.replace("-", "")
+    pkgname = 'mode_' + mode
     pkgdir = tmpdir.mkdir(pkgname)
     pkgdir.join('__init__.py').write(py.code.Source("""
         from py import apipkg
 
 
 def test_chdir_with_relative_imports_shouldnt_break_lazy_loading(tmpdir):
+    from py import _apipkg  # cause py.apipkg is a apimodule
+    tmpdir.join('apipkg.py').write(py.code.Source(_apipkg))
     pkg = tmpdir.mkdir('pkg')
     messy = tmpdir.mkdir('messy')
     pkg.join('__init__.py').write(py.code.Source("""
-        from py import apipkg
+        import apipkg
         apipkg.initpkg(__name__, {
             'test': '.sub:test',
         })
         sys.path.insert(0, '')
         import pkg
         import py
+        print(py.__file__)
         py.builtin.print_(pkg.__path__, file=sys.stderr)
         py.builtin.print_(pkg.__file__, file=sys.stderr)
         py.builtin.print_(pkg, file=sys.stderr)
         os.chdir('messy')
         pkg.test()
+        assert os.path.isabs(pkg.sub.__file__), pkg.sub.__file__
     """))
     res = subprocess.call(
-        ['python', 'main.py'],
+        [py.std.sys.executable, 'main.py'],
         cwd=str(tmpdir),
     )
     assert res == 0