Skip to content

Commit f01a471

Browse files
authored
Merge pull request #17 from JeremieGince/dev
Dev
2 parents 715c2c0 + 6b18f17 commit f01a471

8 files changed

Lines changed: 7 additions & 70 deletions

File tree

.github/pull_request_template.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Please complete the following checklist when submitting a PR. The PR will not be
1010

1111
- [ ] All new features include a unit test.
1212
Make sure that the tests passed and the coverage is
13-
sufficient by running `python run_pytests.py --tests_folder=tests` or
14-
`pytest tests --cov=src --cov-report=term-missing`.
13+
sufficient by running `pytest tests --cov=src --cov-report=term-missing`.
1514
- [ ] All new functions and code are clearly documented.
1615
- [ ] The code is formatted using Black.
1716
You can do this by running `black src tests`.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2024 Jérémie Gince
189+
Copyright 2024 Jeremie Gince
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ The project is constituted by the following parts:
4747
- **.gitattributes**: This file is responsible for setting the git attributes of the project.
4848
- **.gitignore**: This file is responsible for ignoring the files that you don't want to commit to the repository.
4949
A basic one is already provided and should be enough for most of the projects.
50-
- **requirements.txt**: This file is responsible for listing the dependencies of the project.
5150
- **pyproject.toml**: This file is responsible for listing the dependencies of the project and the
5251
configuration of the project.
5352
- **README.md**: This file is responsible for providing information about the project.
@@ -56,7 +55,6 @@ The project is constituted by the following parts:
5655
Feel free to remove it once you used it.
5756
- **setup.py**: This file is responsible for setting up the project.
5857
- **LICENSE**: This file is responsible for providing the license of the project.
59-
- **run_pytests.py**: This script is used by the github actions to run the tests.
6058

6159
# README TEMPLATE
6260

@@ -67,7 +65,8 @@ With `python` and `pip` installed, run the following commands to install the dep
6765
```bash
6866
python -m venv .venv
6967
source .venv/bin/activate
70-
pip install -r requirements.txt
68+
pip install poetry
69+
python -m poetry install
7170
```
7271

7372
With `poetry` installed, run the following commands to install the dependencies:
@@ -126,4 +125,4 @@ python docker_files/build_image_and_run.py --mode=<mode>
126125

127126
## Citation
128127
```
129-
```
128+
```

change_project_attributes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def update_init_file(args):
9191
content = re.sub(r'__email__ = "(.*?)"', f'__email__ = "{args.email}"', content)
9292
if args.url is not None:
9393
content = re.sub(r'__url__ = "(.*?)"', f'__url__ = "{args.url}"', content)
94-
if args.pakage_name is not None:
94+
if args.package_name is not None:
9595
content = re.sub(r'__package__ = "(.*?)"', f'__package__ = "{args.package_name}"', content)
9696
with open(init_file, "w") as f:
9797
f.write(content)
@@ -156,7 +156,7 @@ def update_license(args):
156156
with open("LICENSE", "r") as f:
157157
content = f.read()
158158
if args.author is not None:
159-
content = re.sub(r'Copyright (.*?) (.*?)', f'Copyright {datetime.datetime.now().year} {args.author}', content)
159+
content = re.sub(r'Copyright 2024 Jeremie Gince', f'Copyright {datetime.datetime.now().year} {args.author}', content)
160160
with open("LICENSE", "w") as f:
161161
f.write(content)
162162
return 0
@@ -217,4 +217,3 @@ def main():
217217

218218
if __name__ == '__main__':
219219
sys.exit(main())
220-

tests/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
import numpy as np
2-
import pytest
32

43
from .configs import TEST_SEED
54

65
np.random.seed(TEST_SEED)
7-
8-
9-
def get_slow_test_mark():
10-
from .configs import RUN_SLOW_TESTS
11-
12-
return pytest.mark.skipif(
13-
not RUN_SLOW_TESTS,
14-
reason=f"Only run when configs.{RUN_SLOW_TESTS} is True.",
15-
)

tests/configs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
N_RANDOM_TESTS_PER_CASE = 10
21
TEST_SEED = 42
32

43
ATOL_MATRIX_COMPARISON = 1e-7
@@ -12,5 +11,3 @@
1211

1312
ATOL_SHAPE_COMPARISON = 0
1413
RTOL_SHAPE_COMPARISON = 0
15-
16-
RUN_SLOW_TESTS = True

tests/conftest.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +0,0 @@
1-
import pytest
2-
3-
from .configs import RUN_SLOW_TESTS
4-
5-
RUN_SLOW_ARG_NAME = "run_slow"
6-
7-
8-
@pytest.hookimpl()
9-
def pytest_sessionstart(session):
10-
pass
11-
12-
13-
# @pytest.hookimpl()
14-
# def pytest_sessionfinish(session, exitstatus):
15-
# reporter = session.config.pluginmanager.get_plugin('terminalreporter')
16-
# print('passed amount:', len(reporter.stats['passed']))
17-
18-
19-
def pytest_addoption(parser):
20-
r"""
21-
Add options to the pytest command.
22-
23-
See: https://jwodder.github.io/kbits/posts/pytest-mark-off/.
24-
25-
:param parser: The pytest parser.
26-
:return: None
27-
"""
28-
parser.addoption(
29-
f"--{RUN_SLOW_ARG_NAME}",
30-
action="store_true",
31-
default=RUN_SLOW_TESTS,
32-
help="Run slow tests",
33-
)
34-
35-
36-
def pytest_collection_modifyitems(config, items):
37-
if config.getoption(f"--{RUN_SLOW_ARG_NAME}"):
38-
# if RUN_SLOW_TESTS:
39-
# print("Running slow tests")
40-
pass
41-
else:
42-
# print("Skipping slow tests")
43-
skipper = pytest.mark.skip(reason=f"Only run when '--{RUN_SLOW_ARG_NAME}=True' is given")
44-
for item in items:
45-
if "slow" in item.keywords:
46-
item.add_marker(skipper)

tests/test_dummy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import argparse
2-
import runpy
32

43
import pytest
54

0 commit comments

Comments
 (0)