Skip to content
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

Tox4 with passing test #184

Open
wants to merge 48 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f66a161
Initial commit with base functionality.
Feb 13, 2023
bb87ba7
Merge find_conda functions.
Feb 20, 2023
0fc5068
Rearrange CondaEnvRunner.
Feb 20, 2023
48c40ca
Implement conda_env.
Feb 20, 2023
c792980
Handle conda_env.
Feb 20, 2023
838d5e1
Remove unused code.
Feb 21, 2023
7a0c51e
Installation.
Feb 21, 2023
93c897a
Reformat.
Feb 21, 2023
7504726
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 21, 2023
dfb59dc
Inherit from PythonRun and add type info.
Apr 24, 2023
4aed14c
Reformat plugin with isort and black.
Apr 24, 2023
6afdb36
WIP.
May 30, 2023
1330cad
Fixes.
May 31, 2023
26fe70f
Plugin fixes.
May 31, 2023
b51c6a7
Use executor instead of subprocess.
May 31, 2023
52a8bfb
Test infrastructure wip.
Jun 1, 2023
503e190
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 1, 2023
b2c68cd
Fix test passing.
Jun 1, 2023
b2b45c3
2nd test ready.
Jun 1, 2023
580330a
4th test.
Jun 1, 2023
b5104ee
Format.
Jun 1, 2023
e77fd71
conda_spec test added.
Jun 2, 2023
fcff0cc
Add conda-env test and fixes.
Jun 2, 2023
7bdd51e
Test for env. and spec.
Jun 2, 2023
311a14e
Add conda env. tests are ready.
Jun 2, 2023
af770cf
Add conda_name test.
Jun 2, 2023
10868ef
Format.
Jun 2, 2023
3b7b57e
Add cache tests.
Jun 2, 2023
8e863c4
Add more tests and fixes.
Jun 2, 2023
b27855d
Format.
Jun 2, 2023
9f761eb
Add more tests.
Jun 2, 2023
ebe2c70
Format.
Jun 2, 2023
fa09579
Linting fixes.
Jun 2, 2023
63faefc
Run tests with pytest directly.
Jun 2, 2023
bc0cf59
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 2, 2023
610ddd8
Merge remote-tracking branch 'origin/main' into tox4
Jan 19, 2024
7935e75
Add conda_python option.
Jan 19, 2024
305ff7f
Lint and type fixes.
Jan 19, 2024
023cc54
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 19, 2024
97f68b8
Try fixing tests.
Jan 19, 2024
d50b42d
chore: drop support for python<=3.8
yohlime May 31, 2024
7c49b4d
test: use tox.pytest
yohlime May 31, 2024
0652551
chore: update gitignore
yohlime Jun 1, 2024
b8c4314
refactor: extract CondaEnvRunner class
yohlime Jun 1, 2024
384a7d3
test: find_conda
yohlime Jun 1, 2024
45979fc
test: use pytest-mock
yohlime Jun 1, 2024
478d13e
fix: imports
yohlime Jun 1, 2024
b718b51
test: make test_missing_conda_fallback pass
yohlime Jun 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 27 additions & 76 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,108 +16,59 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: pre-commit/[email protected].0
python-version: "3.10"
- uses: pre-commit/[email protected].1

test:
name: test ${{ matrix.py }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
os:
- Ubuntu
- Windows
- MacOs
py:
- '3.10'
- 3.9
- 3.8
- 3.7
- 3.6
- 3.5
os: ["ubuntu", "windows", "macos"]
py: ["3.12", "3.11", "3.10", "3.9"]
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
- name: Setup Miniconda
uses: conda-incubator/[email protected]
- uses: actions/checkout@v4
- name: setup miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
python-version: ${{ matrix.py }}
- uses: actions/checkout@v4
- name: pick environment to run
miniforge-version: latest
- name: install tox
run: |
import subprocess; import json; import os
major, minor, impl = json.loads(subprocess.check_output(["python", "-c", "import json; import sys; import platform; print(json.dumps([sys.version_info[0], sys.version_info[1], platform.python_implementation()]));"], universal_newlines=True))
with open(os.environ['GITHUB_ENV'], 'a') as file_handler:
file_handler.write('TOXENV=' + ("py" if impl == "CPython" else "pypy") + ("{}{}".format(major, minor) if impl == "CPython" else "3") + "\n")
shell: python
- name: setup test suite
run: tox -vv --notest
mamba install tox
- name: run test suite
run: tox --skip-pkg-install
env:
PYTEST_ADDOPTS: "-vv --durations=20"
CI_RUN: "yes"
DIFF_AGAINST: HEAD
- name: rename coverage report file
run: |
import os; os.rename('.tox/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/coverage.xml')
shell: python
- uses: codecov/codecov-action@v3
with:
file: ./.tox/coverage.xml
flags: tests
name: ${{ matrix.py }} - ${{ matrix.os }}
PYVERSION=${{ matrix.py }}
tox run -e py${PYVERSION//./}

check:
name: check ${{ matrix.tox_env }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
os:
- Windows
- Ubuntu
tox_env:
- dev
- pkg_meta
os: ["ubuntu", "windows"]
tox_env: ["dev", "pkg_meta"]
exclude:
- { os: windows, tox_env: pkg_meta }
steps:
- uses: actions/checkout@v4
- name: setup Python '3.10'
uses: actions/setup-python@v4
- name: setup conda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.10'
python-version: "3.10"
miniforge-version: latest
- name: install tox
run: python -m pip install tox
run: |
mamba install tox
- name: run check for ${{ matrix.tox_env }}
run: python -m tox -e ${{ matrix.tox_env }}
run: tox run -e ${{ matrix.tox_env }}
env:
UPGRADE_ADVISORY: "yes"

publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [check, test, pre_commit]
runs-on: ubuntu-latest
steps:
- name: setup python to build package
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: install pep517
run: python -m pip install build
- uses: actions/checkout@v4
- name: build package
run: python -m build -s -w . -o dist
- name: publish to PyPi
uses: pypa/gh-action-pypi-publish@master
with:
skip_existing: true
user: __token__
password: ${{ secrets.pypi_password }}
193 changes: 167 additions & 26 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,35 +1,176 @@
# python
*.pyc
*.pyo
*.swp
__pycache__
.eggs
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# packaging folders
tox_conda/version.py
/build/
/dist/
/tox_conda.egg-info
# C extensions
*.so

# tox working folder
/.tox
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# IDEs
/.idea
/.vscode
# 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

# tools
/.*_cache
# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# documentation
/docs/_draft.rst
# Pyre type checker
.pyre/

# release
credentials.json
# pytype static type analyzer
.pytype/

pip-wheel-metadata
.DS_Store
.coverage.*
Dockerfile
# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python
8 changes: 8 additions & 0 deletions requirements_tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-e .
devpi_process
pytest
pytest-cov
pytest-mock
pytest-order
pytest-timeout
tox>=4,<5
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ classifiers =
packages = find:
install_requires =
ruamel.yaml>=0.15.0,<0.18
tox>=3.8.1,<4
python_requires = >=3.5
tox>=4,<5
python_requires = >=3.9

[options.packages.find]
exclude = tests
Expand Down
Loading