Changeset 335271e in sasmodels
- Timestamp:
- Jan 31, 2018 2:59:52 PM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 0e7611b
- Parents:
- f354e46
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
.travis.yml
r2ab1bac r335271e 37 37 - conda update --yes conda 38 38 - conda info -a 39 # 2018-01-26 PAK: sasmodels uses yield generator for tests, which isn't supported in pytest 4+ 40 - conda install --yes python=$PY numpy scipy matplotlib docutils setuptools "pytest<4" 39 - conda install --yes python=$PY numpy scipy matplotlib docutils setuptools pytest 41 40 install: 42 41 - pip install bumps -
appveyor.yml
r2ab1bac r335271e 68 68 #- cmd: conda install --yes --quiet obvious-ci 69 69 # 2018-01-19 PAK: skipping toolchain cython and cffi (these were for pyopencl?) 70 # 2018-01-26 PAK: sasmodels uses yield generator for tests, which isn't supported in pytest 4+ 71 - cmd: conda install --yes --quiet numpy scipy matplotlib docutils setuptools "pytest<4" 70 - cmd: conda install --yes --quiet numpy scipy matplotlib docutils setuptools pytest 72 71 # 2018-01-19 PAK: skipping pyopencl; this would be needed for deploy but maybe not for test 73 72 #- cmd: conda install --yes --channel conda-forge pyopencl -
conftest.py
r6dba2f0 r335271e 20 20 import pytest 21 21 from _pytest.unittest import TestCaseFunction 22 from _pytest.compat import is_generator 23 24 def pytest_pycollect_makeitem(collector, name, obj): 25 """ 26 Convert test generator into list of function tests so that pytest doesn't 27 complain about deprecated yield tests. 28 29 Note that unlike nose, the tests are generated and saved instead of run 30 immediately. This means that any dynamic context, such as a for-loop 31 variable, must be captured by wrapping the yield result in a function call. 32 33 For example:: 34 35 for value in 1, 2, 3: 36 for test in test_cases: 37 yield test, value 38 39 will need to be changed to:: 40 41 def build_test(test, value): 42 return test, value 43 for value in 1, 2, 3: 44 for test in test_cases: 45 yield build_test(test, value) 46 47 This allows the context (test and value) to be captured by lexical closure 48 in build_test. See https://stackoverflow.com/a/233835/6195051. 49 """ 50 if collector.istestfunction(obj, name) and is_generator(obj): 51 tests = [pytest.Function(name, parent=collector, args=yielded[1:], callobj=yielded[0]) 52 for yielded in obj()] 53 return tests 54 22 55 23 56 USE_DOCSTRING_AS_DESCRIPTION = True
Note: See TracChangeset
for help on using the changeset viewer.