Commit ac970e74 authored by Michael Droettboom's avatar Michael Droettboom Committed by GitHub

Merge pull request #95 from rth/pytest-package

Package pytest
parents d43c6dcb c9bc2f44
package:
name: atomicwrites
version: 1.1.5
source:
url: https://pypi.io/packages/source/a/atomicwrites/atomicwrites-1.1.5.tar.gz
sha256: 240831ea22da9ab882b551b31d4225591e5e447a68c5e188db5b89ca1d487585
test:
imports:
- atomicwrites
package:
name: attrs
version: 18.1.0
source:
url: https://pypi.io/packages/source/a/attrs/attrs-18.1.0.tar.gz
sha256: e0d0eb91441a3b53dab4d9b743eafc1ac44476296a2053b6ca3af0b139faf87b
patches:
- patches/use-dummy-threading.patch
test:
imports:
- attr
diff --git a/src/attr/_make.py b/src/attr/_make.py
index fc44611..f60016e 100644
--- a/src/attr/_make.py
+++ b/src/attr/_make.py
@@ -3,7 +3,10 @@ from __future__ import absolute_import, division, print_function
import hashlib
import linecache
import sys
-import threading
+try:
+ import threading
+except ImportError:
+ import dummy_threading as threading
import warnings
from operator import itemgetter
package:
name: more-itertools
version: 4.3.0
source:
url: https://pypi.io/packages/source/m/more-itertools/more-itertools-4.3.0.tar.gz
sha256: c476b5d3a34e12d40130bc2f935028b5f636df8f372dc2c1c01dc19681b2039e
test:
imports:
- more_itertools
package:
name: nose
version: 1.3.7
source:
url: https://pypi.io/packages/source/n/nose/nose-1.3.7.tar.gz
sha256: f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98
requirements:
run:
- setuptools
test:
imports:
- nose
package:
name: pluggy
version: 0.7.1
source:
url: https://pypi.io/packages/source/p/pluggy/pluggy-0.7.1.tar.gz
sha256: 95eb8364a4708392bae89035f45341871286a333f749c3141c20573d2b3876e1
test:
imports:
- pluggy
package:
name: py
version: 1.5.4
source:
url: https://pypi.io/packages/source/p/py/py-1.5.4.tar.gz
sha256: 3fd59af7435864e1a243790d322d763925431213b6b8529c6ca71081ace3bbf7
test:
imports:
- py
- py.code
package:
name: pytest
version: 3.6.3
source:
url: https://files.pythonhosted.org/packages/55/50/399419c03c39bf41faa7cbd5a8976c076037b2d76adf2535610919806d67/pytest-3.6.3.tar.gz
md5: 8ca6124a3a80f9555c50f5c09056ea02
patches:
- patches/named-tmp-and-rm-dup2.patch
requirements:
run:
- atomicwrites
- attrs
- more-itertools
- pluggy
- py
- setuptools
test:
imports:
- pytest
diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py
index faa767a8..518f5c8b 100644
--- a/src/_pytest/capture.py
+++ b/src/_pytest/capture.py
@@ -10,7 +10,7 @@ import sys
import os
import io
from io import UnsupportedOperation
-from tempfile import TemporaryFile
+from tempfile import NamedTemporaryFile as TemporaryFile
import six
import pytest
@@ -471,7 +471,6 @@ class FDCaptureBinary(object):
else:
self.syscapture = NoCapture()
self.tmpfile = tmpfile
- self.tmpfile_fd = tmpfile.fileno()
def __repr__(self):
return "<FDCapture %s oldfd=%s>" % (self.targetfd, self.targetfd_save)
@@ -482,7 +481,6 @@ class FDCaptureBinary(object):
os.fstat(self.targetfd_save)
except (AttributeError, OSError):
raise ValueError("saved filedescriptor not valid anymore")
- os.dup2(self.tmpfile_fd, self.targetfd)
self.syscapture.start()
def snap(self):
@@ -496,18 +494,14 @@ class FDCaptureBinary(object):
""" stop capturing, restore streams, return original capture file,
seeked to position zero. """
targetfd_save = self.__dict__.pop("targetfd_save")
- os.dup2(targetfd_save, self.targetfd)
- os.close(targetfd_save)
self.syscapture.done()
_attempt_to_close_capture_file(self.tmpfile)
def suspend(self):
self.syscapture.suspend()
- os.dup2(self.targetfd_save, self.targetfd)
def resume(self):
self.syscapture.resume()
- os.dup2(self.tmpfile_fd, self.targetfd)
def writeorg(self, data):
""" write to original file descriptor. """
diff --git a/src/_pytest/pastebin.py b/src/_pytest/pastebin.py
index 6af202d1..9b192918 100644
--- a/src/_pytest/pastebin.py
+++ b/src/_pytest/pastebin.py
@@ -29,7 +29,7 @@ def pytest_configure(config):
# when using pytest-xdist, for example
if tr is not None:
# pastebin file will be utf-8 encoded binary file
- config._pastebinfile = tempfile.TemporaryFile("w+b")
+ config._pastebinfile = tempfile.NamedTemporaryFile("w+b")
oldwrite = tr._tw.write
def tee_write(s, **kwargs):
package:
name: setuptools
version: 40.0.0
source:
url: https://pypi.io/packages/source/s/setuptools/setuptools-40.0.0.zip
sha256: 012adb8e25fbfd64c652e99e7bab58799a3aaf05d39ab38561f69190a909015f
patches:
- patches/remove-ctypes.patch
requirements:
run:
- pyparsing
test:
imports:
- setuptools
- easy_install
- pkg_resources
diff --git a/setuptools/glibc.py b/setuptools/glibc.py
index a134591c..c31fc78a 100644
--- a/setuptools/glibc.py
+++ b/setuptools/glibc.py
@@ -2,13 +2,13 @@
# https://github.com/pypa/pip/blob/8f4f15a5a95d7d5b511ceaee9ed261176c181970/src/pip/_internal/utils/glibc.py
from __future__ import absolute_import
-import ctypes
import re
import warnings
def glibc_version_string():
"Returns glibc version string, or None if not using glibc."
+ import ctypes
# ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen
# manpage says, "If filename is NULL, then the returned handle is for the
diff --git a/setuptools/windows_support.py b/setuptools/windows_support.py
index cb977cff..1ca64fbb 100644
--- a/setuptools/windows_support.py
+++ b/setuptools/windows_support.py
@@ -1,5 +1,4 @@
import platform
-import ctypes
def windows_only(func):
@@ -17,6 +16,7 @@ def hide_file(path):
`path` must be text.
"""
+ import ctypes
__import__('ctypes.wintypes')
SetFileAttributes = ctypes.windll.kernel32.SetFileAttributesW
SetFileAttributes.argtypes = ctypes.wintypes.LPWSTR, ctypes.wintypes.DWORD
def test_pytest(selenium):
selenium.load_package('pytest')
selenium.load_package('numpy')
selenium.load_package('nose')
selenium.run('from pathlib import Path')
selenium.run('import os')
selenium.run('import numpy')
selenium.run('base_dir = Path(numpy.__file__).parent / "core" / "tests"')
selenium.run("import pytest;"
"pytest.main([base_dir / 'test_api.py'])")
logs = '\n'.join(selenium.logs)
assert 'INTERNALERROR' not in logs
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment