Codebase list pytest-factoryboy / 9258b6bb-5597-43de-9ee7-0b6b5e217b35/upstream
Import upstream version 2.0.3 Kali Janitor 3 years ago
8 changed file(s) with 59 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
00 sudo: false
11 language: python
2 # enable Python 3.5 on travis until it will be pre-installed
3 python: 3.5
4 env:
5 matrix:
6 - TESTENV=py27-pytest2
7 - TESTENV=py34-pytest2
8 - TESTENV=py35-pytest2
9 - TESTENV=py27-pytest3
10 - TESTENV=py34-pytest3
11 - TESTENV=py35-pytest3
2 dist: xenial
3 python:
4 - "2.7"
5 - "3.5"
6 - "3.6"
7 - "3.7"
8
129 install:
13 - pip install tox
14 script: tox -e $TESTENV
10 - pip install tox tox-travis
11 script: tox
1512 branches:
16 except:
17 - /^\d/
13 except:
14 - /^\d/
1815 notifications:
19 email:
20 - [email protected]
21 - [email protected]
16 email:
17 - [email protected]
18 - [email protected]
00 Changelog
11 =========
2
3 2.0.3
4 -----
5
6 - Fix compatibility with pytest 5.
7
28
39 2.0.2
410 -----
44 :target: https://pypi.python.org/pypi/pytest-factoryboy
55 .. image:: https://img.shields.io/pypi/pyversions/pytest-factoryboy.svg
66 :target: https://pypi.python.org/pypi/pytest-factoryboy
7 .. image:: https://img.shields.io/coveralls/pytest-dev/pytest-factoryboy/master.svg
8 :target: https://coveralls.io/r/pytest-dev/pytest-factoryboy
97 .. image:: https://travis-ci.org/pytest-dev/pytest-factoryboy.svg?branch=master
108 :target: https://travis-ci.org/pytest-dev/pytest-factoryboy
119 .. image:: https://readthedocs.org/projects/pytest-factoryboy/badge/?version=latest
7472 from pytest_factoryboy import register
7573
7674 @register
77 class AuthorFactory(Factory):
75 class AuthorFactory(factory.Factory):
7876
7977 class Meta:
8078 model = Author
00 """pytest-factoryboy public API."""
11 from .fixture import register, LazyFixture
22
3 __version__ = '2.0.2'
3 __version__ = '2.0.3'
44
55
66 __all__ = [
00 """Factory boy fixture integration."""
11
22 import sys
3 import inspect
43
54 import factory
65 import factory.builder
98 import inflection
109 import pytest
1110
11 from inspect import getmodule
12
13 if sys.version_info > (3, 0):
14 from inspect import signature
15 else:
16 from funcsigs import signature
1217
1318 SEPARATOR = "__"
1419
315320 def get_caller_module(depth=2):
316321 """Get the module of the caller."""
317322 frame = sys._getframe(depth)
318 module = inspect.getmodule(frame)
323 module = getmodule(frame)
319324 # Happens when there's no __init__.py in the folder
320325 if module is None:
321326 return get_caller_module(depth=depth) # pragma: no cover
332337 """
333338 self.fixture = fixture
334339 if callable(self.fixture):
335 self.args = list(inspect.getargspec(self.fixture).args)
340 params = signature(self.fixture).parameters.values()
341 self.args = [
342 param.name for param in params
343 if param.kind == param.POSITIONAL_OR_KEYWORD
344 ]
336345 else:
337346 self.args = [self.fixture]
338347
112112 def pytest_addhooks(pluginmanager):
113113 """Register plugin hooks."""
114114 from pytest_factoryboy import hooks
115 # addhooks is for older py.test and deprecated; replaced by add_hookspecs
116 add_hookspecs = getattr(pluginmanager, 'add_hookspecs', pluginmanager.addhooks)
117 add_hookspecs(hooks)
115 pluginmanager.add_hookspecs(hooks)
118116
119117
120118 def pytest_generate_tests(metafunc):
123121 fixturedef = arg2fixturedef[-1]
124122 related.extend(getattr(fixturedef.func, "_factoryboy_related", []))
125123
126 metafunc.funcargnames.extend(related)
124 metafunc.fixturenames.extend(related)
3737 "Topic :: Utilities",
3838 "Programming Language :: Python :: 2",
3939 "Programming Language :: Python :: 3"
40 ] + [("Programming Language :: Python :: %s" % x) for x in "2.7 3.0 3.1 3.2 3.3 3.4 3.5".split()],
40 ] + [("Programming Language :: Python :: %s" % x) for x in "2.7 3.4 3.5 3.6 3.7".split()],
4141 install_requires=[
4242 "inflection",
4343 "factory_boy>=2.10.0",
4444 "pytest>=3.3.2",
45 'funcsigs;python_version<"3.0"',
4546 ],
4647 # the following makes a plugin available to py.test
4748 entry_points={
00 [tox]
11 distshare = {homedir}/.tox/distshare
2 envlist = py{27,34,35}-pytest{2,3}
3
2 envlist = py27-pytest{36,37,38,39,310,4,41,42,43,44,45,46},
3 py37-pytest{36,37,38,39,310,4,41,42,43,44,45,46,5,latest},
4 py{35,36}-pytestlatest
45
56 [testenv]
6 commands = py.test --junitxml={envlogdir}/junit-{envname}.xml {posargs:tests}
7 deps = -r{toxinidir}/requirements-testing.txt
8 pytest2: pytest<3.0
9 pytest3: pytest>3.0
7 commands = pytest --junitxml={envlogdir}/junit-{envname}.xml {posargs:tests}
8 deps =
9 pytestlatest: pytest
10 pytest5: pytest~=5.0.0
11 pytest46: pytest~=4.6.0
12 pytest45: pytest~=4.5.0
13 pytest44: pytest~=4.4.0
14 pytest43: pytest~=4.3.0
15 pytest42: pytest~=4.2.0
16 pytest41: pytest~=4.1.0
17 pytest4: pytest~=4.0.0
18 pytest310: pytest~=3.10.0
19 pytest39: pytest~=3.9.0
20 pytest38: pytest~=3.8.0
21 pytest37: pytest~=3.7.0
22 pytest36: pytest~=3.6.0
23
24 -r{toxinidir}/requirements-testing.txt
1025
1126 [pytest]
1227 addopts = -vv -l --pep8