(session, rcfile, flags, paths)
| 1596 | |
| 1597 | |
| 1598 | def _lint_pre_commit(session, rcfile, flags, paths): |
| 1599 | if "VIRTUAL_ENV" not in os.environ: |
| 1600 | session.error( |
| 1601 | "This should be running from within a virtualenv and " |
| 1602 | "'VIRTUAL_ENV' was not found as an environment variable." |
| 1603 | ) |
| 1604 | if "pre-commit" not in os.environ["VIRTUAL_ENV"]: |
| 1605 | session.error( |
| 1606 | "This should be running from within a pre-commit virtualenv and " |
| 1607 | "'VIRTUAL_ENV'({}) does not appear to be a pre-commit virtualenv.".format( |
| 1608 | os.environ["VIRTUAL_ENV"] |
| 1609 | ) |
| 1610 | ) |
| 1611 | from nox.virtualenv import VirtualEnv |
| 1612 | |
| 1613 | # Let's patch nox to make it run inside the pre-commit virtualenv |
| 1614 | session._runner.venv = VirtualEnv( |
| 1615 | os.environ["VIRTUAL_ENV"], |
| 1616 | interpreter=session._runner.func.python, |
| 1617 | reuse_existing=True, |
| 1618 | venv=True, |
| 1619 | ) |
| 1620 | _lint( |
| 1621 | session, |
| 1622 | rcfile, |
| 1623 | flags, |
| 1624 | paths, |
| 1625 | upgrade_setuptools_and_pip=False, |
| 1626 | ) |
| 1627 | |
| 1628 | |
| 1629 | @nox.session(python="3") |
no test coverage detected