| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5ead8ef commit da940f5
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,6 @@ environment: | |||
| 9 | 9 | global: | |
| 10 | 10 | PYTHONUNBUFFERED: True | |
| 11 | 11 | PYTHONWARNINGS: 'ignore:::wheel.pep425tags:' | |
| 12 | - PYTHONPATH: C:\testdir | ||
| 13 | 12 | CONDA_BLD: C:\miniconda35 | |
| 14 | 13 | ||
| 15 | 14 | matrix: | |
@@ -34,11 +33,6 @@ init: | |||
| 34 | 33 | # Prepend newly installed Python to the PATH of this build | |
| 35 | 34 | - set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH% | |
| 36 | 35 | ||
| 37 | - # Check that we have the expected version, architecture for Python | ||
| 38 | - - python --version | ||
| 39 | - - python -c "import struct; print(struct.calcsize('P') * 8)" | ||
| 40 | - - python -c "import ctypes; print(ctypes.sizeof(ctypes.c_wchar))" | ||
| 41 | - | ||
| 42 | 36 | install: | |
| 43 | 37 | - pip install --upgrade -r requirements.txt | |
| 44 | 38 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,57 +1,31 @@ | |||
| 1 | 1 | # -*- coding: utf-8 -*- | |
| 2 | - # TODO: move tests one out of src. Pythonnet doesn't run... | ||
| 2 | + # TODO: move tests one out of src to project root. | ||
| 3 | + # TODO: travis has numpy on their workers. Maybe add tests? | ||
| 3 | 4 | ||
| 4 | 5 | """Helpers for testing.""" | |
| 5 | 6 | ||
| 6 | - import io | ||
| 7 | - import os | ||
| 7 | + import ctypes | ||
| 8 | 8 | import sys | |
| 9 | + import sysconfig | ||
| 9 | 10 | ||
| 10 | - import pytest | ||
| 11 | 11 | import clr | |
| 12 | 12 | ||
| 13 | + # Add path for Python.Test & Add References | ||
| 13 | 14 | sys.path.append('C:/testdir/') | |
| 14 | 15 | clr.AddReference("Python.Test") | |
| 15 | 16 | clr.AddReference("System.Collections") | |
| 16 | 17 | clr.AddReference("System.Data") | |
| 17 | 18 | ||
| 18 | - DIR_PATH = os.path.dirname(__file__) | ||
| 19 | - FILES_DIR = os.path.join(DIR_PATH, 'files') | ||
| 20 | 19 | ||
| 20 | + def pytest_report_header(config): | ||
| 21 | + """Generate extra report headers""" | ||
| 22 | + # FIXME: https://github.com/pytest-dev/pytest/issues/2257 | ||
| 23 | + is_64bits = sys.maxsize > 2**32 | ||
| 24 | + arch = "x64" if is_64bits else "x86" | ||
| 25 | + ucs = ctypes.sizeof(ctypes.c_wchar) | ||
| 26 | + libdir = sysconfig.get_config_var("LIBDIR") | ||
| 27 | + shared = bool(sysconfig.get_config_var("Py_ENABLE_SHARED")) | ||
| 21 | 28 | ||
| 22 | - @pytest.fixture() | ||
| 23 | - def filepath(): | ||
| 24 | - """Returns full file path for test files.""" | ||
| 25 | - | ||
| 26 | - def make_filepath(filename): | ||
| 27 | - # http://stackoverflow.com/questions/18011902/parameter-to-a-fixture | ||
| 28 | - # Alternate solution is to use paramtrization `inderect=True` | ||
| 29 | - # http://stackoverflow.com/a/33879151 | ||
| 30 | - # Syntax is noisy and requires specific variable names | ||
| 31 | - return os.path.join(FILES_DIR, filename) | ||
| 32 | - | ||
| 33 | - return make_filepath | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - @pytest.fixture() | ||
| 37 | - def load_file(filepath): | ||
| 38 | - """Opens filename with encoding and return its contents.""" | ||
| 39 | - | ||
| 40 | - def make_load_file(filename, encoding='utf-8'): | ||
| 41 | - # http://stackoverflow.com/questions/18011902/parameter-to-a-fixture | ||
| 42 | - # Alternate solution is to use paramtrization `inderect=True` | ||
| 43 | - # http://stackoverflow.com/a/33879151 | ||
| 44 | - # Syntax is noisy and requires specific variable names | ||
| 45 | - # And seems to be limited to only 1 argument. | ||
| 46 | - with io.open(filepath(filename), encoding=encoding) as f: | ||
| 47 | - return f.read().strip() | ||
| 48 | - | ||
| 49 | - return make_load_file | ||
| 50 | - | ||
| 51 | - | ||
| 52 | - @pytest.fixture() | ||
| 53 | - def get_stream(filepath): | ||
| 54 | - def make_stream(filename, encoding='utf-8'): | ||
| 55 | - return io.open(filepath(filename), encoding=encoding) | ||
| 56 | - | ||
| 57 | - return make_stream | ||
| 29 | + header = ("Arch: {arch}, UCS: {ucs}, LIBDIR: {libdir}, " | ||
| 30 | + "Py_ENABLE_SHARED: {shared}".format(**locals())) | ||
| 31 | + return header | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments