-
-
Notifications
You must be signed in to change notification settings - Fork 7
Modernize project #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * @gaborbernat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "daily" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| name: check | ||
| on: | ||
| push: | ||
| pull_request: | ||
| schedule: | ||
| - cron: "0 8 * * *" | ||
|
|
||
| concurrency: | ||
| group: check-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| name: test ${{ matrix.py }} - ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| py: | ||
| - "3.11.0-rc.2" | ||
| - "3.10" | ||
| - "3.9" | ||
| - "3.8" | ||
| - "3.7" | ||
| os: | ||
| - ubuntu-22.04 | ||
|
|
||
| steps: | ||
| - name: Setup python for tox | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.10" | ||
| - name: Install tox | ||
| run: python -m pip install tox | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup python for test ${{ matrix.py }} | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.py }} | ||
| - name: Pick environment to run | ||
| run: | | ||
| import codecs; import os; import sys | ||
| env = "TOXENV=py{}{}\n".format(*sys.version_info[0:2]) | ||
| print("Picked:\n{}for{}".format(env, sys.version)) | ||
| with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler: | ||
| file_handler.write(env) | ||
| shell: python | ||
| - name: Setup test suite | ||
| run: tox -vv --notest | ||
| - name: Run test suite | ||
| run: tox --skip-pkg-install | ||
| env: | ||
| CI_RUN: "yes" | ||
|
|
||
| check: | ||
| name: ${{ matrix.tox_env }} - ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: | ||
| - ubuntu-22.04 | ||
| tox_env: | ||
| - dev | ||
| - type | ||
| - readme | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup Python "3.10" | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.10" | ||
| - name: Install tox | ||
| run: python -m pip install tox | ||
| - name: Setup test suite | ||
| run: tox -vv --notest -e ${{ matrix.tox_env }} | ||
| - name: Run test suite | ||
| run: tox --skip-pkg-install -e ${{ matrix.tox_env }} | ||
|
|
||
| publish: | ||
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
| needs: [ test, check ] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Setup python to build package | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.10" | ||
| - name: Install build | ||
| run: python -m pip install build | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Build sdist and wheel | ||
| run: python -m build -s -w . -o dist | ||
| - name: Publish to PyPi | ||
| uses: pypa/gh-action-pypi-publish@v1.5.1 | ||
| with: | ||
| skip_existing: true | ||
| user: __token__ | ||
| password: ${{ secrets.pypi_password }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,5 @@ | ||
| # Byte-compiled / optimized / DLL files | ||
| __pycache__/ | ||
| *.py[cod] | ||
|
|
||
| # C extensions | ||
| *.so | ||
|
|
||
| # Distribution / packaging | ||
| .Python | ||
| env/ | ||
| build/ | ||
| develop-eggs/ | ||
| *.pyc | ||
| *.egg-info | ||
| dist/ | ||
| downloads/ | ||
| eggs/ | ||
| lib/ | ||
| lib64/ | ||
| parts/ | ||
| sdist/ | ||
| var/ | ||
| *.egg-info/ | ||
| .installed.cfg | ||
| *.egg | ||
|
|
||
| # PyInstaller | ||
| # Usually these files are written by a python script from a template | ||
| # before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
| *.manifest | ||
| *.spec | ||
|
|
||
| # Installer logs | ||
| pip-log.txt | ||
| pip-delete-this-directory.txt | ||
|
|
||
| # Unit test / coverage reports | ||
| htmlcov/ | ||
| .tox/ | ||
| .coverage | ||
| .cache | ||
| nosetests.xml | ||
| coverage.xml | ||
|
|
||
| # Translations | ||
| *.mo | ||
| *.pot | ||
|
|
||
| # Django stuff: | ||
| *.log | ||
|
|
||
| # Sphinx documentation | ||
| docs/_build/ | ||
|
|
||
| # PyBuilder | ||
| target/ | ||
| /src/pytest_env/version.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v4.3.0 | ||
| hooks: | ||
| - id: check-ast | ||
| - id: check-builtin-literals | ||
| - id: check-docstring-first | ||
| - id: check-merge-conflict | ||
| - id: check-yaml | ||
| - id: check-toml | ||
| - id: debug-statements | ||
| - id: end-of-file-fixer | ||
| - id: trailing-whitespace | ||
| - repo: https://github.com/asottile/pyupgrade | ||
| rev: v3.0.0 | ||
| hooks: | ||
| - id: pyupgrade | ||
| args: [ "--py37-plus" ] | ||
| - repo: https://github.com/PyCQA/isort | ||
| rev: 5.10.1 | ||
| hooks: | ||
| - id: isort | ||
| - repo: https://github.com/psf/black | ||
| rev: 22.10.0 | ||
| hooks: | ||
| - id: black | ||
| args: [ --safe ] | ||
| - repo: https://github.com/asottile/blacken-docs | ||
| rev: v1.12.1 | ||
| hooks: | ||
| - id: blacken-docs | ||
| additional_dependencies: [ black==22.10 ] | ||
| - repo: https://github.com/pre-commit/pygrep-hooks | ||
| rev: v1.9.0 | ||
| hooks: | ||
| - id: rst-backticks | ||
| - repo: https://github.com/tox-dev/tox-ini-fmt | ||
| rev: "0.5.2" | ||
| hooks: | ||
| - id: tox-ini-fmt | ||
| args: [ "-p", "fix" ] | ||
| - repo: https://github.com/PyCQA/flake8 | ||
| rev: 5.0.4 | ||
| hooks: | ||
| - id: flake8 | ||
| additional_dependencies: | ||
| - flake8-bugbear==22.9.23 | ||
| - flake8-comprehensions==3.10 | ||
| - flake8-pytest-style==1.6 | ||
| - flake8-spellcheck==0.28 | ||
| - flake8-unused-arguments==0.0.11 | ||
| - flake8-noqa==1.2.9 | ||
| - pep8-naming==0.13.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,47 @@ | ||
| # pytest-env | ||
|
|
||
| [](https://pypi.org/project/pytest-env/) | ||
| [](https://pypi.org/project/pytest-env/) | ||
| [](https://github.com/pytest-dev/pytest-env/actions/workflows/check.yml) | ||
| [](https://github.com/psf/black) | ||
| [](https://pepy.tech/project/pytest-env/month) | ||
|
|
||
| This is a py.test plugin that enables you to set environment variables in the pytest.ini file. | ||
|
|
||
| ## Installation | ||
|
|
||
| Install with pip: | ||
|
|
||
| pip install pytest-env | ||
|
|
||
| Uninstall with pip: | ||
|
|
||
| pip uninstall pytest-env | ||
| ```shell | ||
| pip install pytest-env | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| In your pytest.ini file add a key value pair with `env` as the key and the environment variables as a line separated list of `KEY=VALUE` entries. The defined variables will be added to the environment before any tests are run: | ||
|
|
||
| [pytest] | ||
| env = | ||
| HOME=~/tmp | ||
| RUN_ENV=test | ||
| ```ini | ||
| [pytest] | ||
| env = | ||
| HOME=~/tmp | ||
| RUN_ENV=test | ||
| ``` | ||
|
|
||
| You can use `D:` (default) as prefix if you don't want to override existing environment variables: | ||
|
|
||
| [pytest] | ||
| env = | ||
| D:HOME=~/tmp | ||
| D:RUN_ENV=test | ||
| ```ini | ||
| [pytest] | ||
| env = | ||
| D:HOME=~/tmp | ||
| D:RUN_ENV=test | ||
| ``` | ||
|
|
||
| Lastly, you can use existing environment variables using a python-like format: | ||
|
|
||
| [pytest] | ||
| env = | ||
| RUN_PATH=/run/path/{USER} | ||
| ```ini | ||
| [pytest] | ||
| env = | ||
| RUN_PATH=/run/path/{USER} | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| [build-system] | ||
| build-backend = "hatchling.build" | ||
| requires = ["hatchling>=1.11", "hatch-vcs>=0.2"] | ||
|
|
||
| [project] | ||
| name = "pytest-env" | ||
| description = "py.test plugin that allows you to add environment variables." | ||
| readme = "README.md" | ||
| license.file = "LICENSE" | ||
| maintainers = [{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" }] | ||
| urls.Documentation = "https://bump-deps-index.readthedocs.io" | ||
| urls.Homepage = "https://github.com/pytest-dev/pytest-env" | ||
| urls.Source = "https://github.com/pytest-dev/pytest-env" | ||
| urls.Tracker = "https://github.com/pytest-dev/pytest-env/issues" | ||
| requires-python = ">=3.7" | ||
| dependencies = ["pytest>=7.1.3"] | ||
| optional-dependencies.test = ["coverage>=6.5", "pytest-mock>=3.10", "covdefaults>=2.2"] | ||
| keywords = ["pytest", "env"] | ||
| classifiers = [ | ||
| "Development Status :: 5 - Production/Stable", | ||
| "Intended Audience :: Developers", | ||
| "License :: OSI Approved :: MIT License", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3 :: Only", | ||
| "Programming Language :: Python :: Implementation :: CPython", | ||
| "Topic :: Software Development :: Libraries :: Python Modules", | ||
| ] | ||
| dynamic = ["version"] | ||
|
|
||
| [project.entry-points.pytest11] | ||
| env = "pytest_env.plugin" | ||
|
|
||
| [tool.hatch] | ||
| build.hooks.vcs.version-file = "src/pytest_env/version.py" | ||
| version.source = "vcs" | ||
|
|
||
| [tool.black] | ||
| line-length = 120 | ||
|
|
||
| [tool.coverage] | ||
| source = ["${_COVERAGE_SRC}", "${_COVERAGE_TEST}"] | ||
| run.dynamic_context = "test_function" | ||
| run.plugins = ["covdefaults"] | ||
| run.parallel = true | ||
| report.fail_under = 100 | ||
| html.show_contexts = true | ||
| html.skip_covered = false | ||
| paths.source = [ | ||
| "src", | ||
| ".tox*/*/lib/python*/site-packages", | ||
| ".tox*/pypy*/site-packages", | ||
| ".tox*\\*\\Lib\\site-packages", | ||
| "*/src", | ||
| "*\\src", | ||
| ] | ||
|
|
||
| [tool.mypy] | ||
| python_version = "3.10" | ||
| show_error_codes = true | ||
| strict = true | ||
|
|
||
| [tool.isort] | ||
| profile = "black" | ||
| known_first_party = ["pytest_env"] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, leftover. Pr welcome.