Skip to content

Commit

Permalink
Reverting to individual configuration files as per discussion
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigurd-Borge committed Oct 11, 2024
1 parent 6c3619d commit 83a5936
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 62 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[coverage:run]
# needed to not have absolute path in coverage.xml
relative_files = True
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Test
run: |
pytest --cov-config=pyproject.toml --cov src --cov-report xml tests/antares
pytest --cov src --cov-report xml tests/antares
- name: Archive code coverage results
uses: actions/upload-artifact@v4
Expand Down
6 changes: 6 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[mypy]
mypy_path = src
packages= antares
disallow_untyped_defs = true
disallow_untyped_calls = true

61 changes: 0 additions & 61 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,68 +33,7 @@ classifiers = [
Repository = "https://github.com/AntaresSimulatorTeam/antares_craft"
"Bug Tracker" = "https://github.com/AntaresSimulatorTeam/antares_craft/issues"

# Coverage
[tool.coverage.run]
relative_files = true

# Mypy
[tool.mypy]
mypy_path = "src"
packages = "antares"
disallow_untyped_defs = true
disallow_untyped_calls = true

# Pytest
[tool.pytest.ini_options]
pythonpath = "src"
testpaths = "tests"
log_cli = true
junit_family= "xunit2"

# Ruff
[tool.ruff]
line-length = 120

[tool.ruff.lint]
## E4, E7, E9 and F are the default configuration of ruff, "I" is added to handle imports
select = ["E4", "E7", "E9", "F", "I"]

[tool.ruff.lint.isort]
## Use a single line between direct import and from import.
lines-between-types = 1
section-order = [
"testing",
"future",
"standard-library",
"third-party",
"first-party",
"local-folder",
]

[tool.ruff.lint.isort.sections]
testing = ["pytest*", "*mock*"]

# Setuptools
[tool.setuptools.packages.find]
## All the following settings are optional:
where = ["src"]

[tool.tox]
requires = ["tox>=4.21"]
env_list =["py3.9", "py3.10", "py3.11", "py3.12", "lint"]

[tool.tox.env_run_base]
description = "run the tests with pytest"
deps = ["-r requirements-dev.txt"]
commands = [["pytest", "tests/antares"]]

[tool.tox.env.lint]
description = "linting with ruff and typechecking with mypy"
extras = ["lint"]
commands = [
["python", "scripts/license_checker_and_adder.py", "--path=src", "--action=fix"],
["python", "scripts/license_checker_and_adder.py", "--path=tests", "--action=fix"],
["ruff", "check", "--fix", "src/", "tests/"],
["ruff", "format", "src/", "tests/"],
["mypy"]
]
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
pythonpath = src
testpaths = tests
log_cli = true
junit_family=xunit2
20 changes: 20 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
line-length = 120

[lint]
## E4, E7, E9 and F are the default configuration of ruff, "I" is added to handle imports
select = ["E4", "E7", "E9", "F", "I"]

[lint.isort]
## Use a single line between direct import and from import.
lines-between-types = 1
section-order = [
"testing",
"future",
"standard-library",
"third-party",
"first-party",
"local-folder",
]

[lint.isort.sections]
testing = ["pytest*", "*mock*"]
24 changes: 24 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[tox]
env_list =
py3.{9,10,11,12}-test
lint

[testenv]
deps =
-r requirements-dev.txt

[testenv:py3.{9,10,11,12}-test]
description = run the tests with pytest
commands =
pytest tests/antares {posargs}

[testenv:lint]
description = linting with ruff
extras = lint
commands =
python scripts/license_checker_and_adder.py --path=src --action=fix
python scripts/license_checker_and_adder.py --path=tests --action=fix
ruff check --fix src/ tests/ {posargs}
ruff format src/ tests/ {posargs}
mypy {posargs}

0 comments on commit 83a5936

Please sign in to comment.