From 4404274eefad3daf6c2d54e0fc3e8bed48ae8185 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Thu, 23 Aug 2018 17:48:57 +0300 Subject: [PATCH] Package nose --- packages/nose/meta.yaml | 15 +++++++++ .../patches/use-named-temporary-file.patch | 33 ++++++++++++++++++- test/test_packaging.py | 11 ------- test/test_testing.py | 14 ++++++++ 4 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 packages/nose/meta.yaml delete mode 100644 test/test_packaging.py create mode 100644 test/test_testing.py diff --git a/packages/nose/meta.yaml b/packages/nose/meta.yaml new file mode 100644 index 000000000..508a28b96 --- /dev/null +++ b/packages/nose/meta.yaml @@ -0,0 +1,15 @@ +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 diff --git a/packages/pytest/patches/use-named-temporary-file.patch b/packages/pytest/patches/use-named-temporary-file.patch index 27858560f..9aceeec68 100644 --- a/packages/pytest/patches/use-named-temporary-file.patch +++ b/packages/pytest/patches/use-named-temporary-file.patch @@ -1,5 +1,5 @@ diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py -index faa767a8..23298939 100644 +index faa767a8..551484b0 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -10,7 +10,7 @@ import sys @@ -11,6 +11,37 @@ index faa767a8..23298939 100644 import six import pytest +@@ -482,7 +482,7 @@ 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.tmpfile_fd = os.dup(self.targetfd) + self.syscapture.start() + + def snap(self): +@@ -496,18 +496,18 @@ 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) ++ targetfd_save = os.dup(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) ++ self.targetfd_save = os.dup(self.targetfd) + + def resume(self): + self.syscapture.resume() +- os.dup2(self.tmpfile_fd, self.targetfd) ++ self.tmpfile_fd = os.dup(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 diff --git a/test/test_packaging.py b/test/test_packaging.py deleted file mode 100644 index 5de6debe2..000000000 --- a/test/test_packaging.py +++ /dev/null @@ -1,11 +0,0 @@ -def test_pytest(selenium): - selenium.load_package('pytest') - selenium.load_package('pandas') - selenium.run('from pathlib import Path') - selenium.run('import os') - selenium.run('import pandas as pd') - selenium.run('base_dir = Path(pd.__file__).parent / "tests" / "frame"') - selenium.run('print(base_dir)') - selenium.run('print(list(sorted(os.listdir(base_dir))))') - selenium.run("import pytest;" - "pytest.main([base_dir / 'test_sorting.py'])") diff --git a/test/test_testing.py b/test/test_testing.py new file mode 100644 index 000000000..a2f22b764 --- /dev/null +++ b/test/test_testing.py @@ -0,0 +1,14 @@ +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('print(base_dir)') + selenium.run('print(list(sorted(os.listdir(base_dir))))') + selenium.run("import pytest;" + "pytest.main([base_dir / 'test_api.py'])") + logs = '\n'.join(selenium.logs) + assert 'INTERNALERROR' not in logs