def run_test()

in noxfile.py [0:0]


def run_test(session, dir):
    session.install('-r', 'requirements.txt')
    session.chdir(dir)
    if os.path.exists('requirements.txt'):
        session.install('-r', 'requirements.txt')

    session.env['PYTHONPATH'] = os.getcwd()
    session.run(
        'pytest',
        *(PYTEST_COMMON_ARGS + session.posargs),
        # Pytest will return 5 when no tests are collected. This can happen
        # when slow and flaky tests are excluded.
        # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
        success_codes=[0, 5])