Skip to content

Commit 3ccf333

Browse files
committed
Update exercise
1 parent f9612e8 commit 3ccf333

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

05_testing_and_ci/python_testing_exercise.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
## Starting Remarks
44

5-
- [Exercise repository link](https://github.com/Simulation-Software-Engineering/testing-python-exercise-wt2223)
6-
- Deadline for submitting this exercise is **Thursday 26th January 2023 09:00**.
7-
- Structure all the tests in a format similar to what is shown in the [demo code](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/examples/python_testing).
5+
- [Exercise repository link](https://github.com/Simulation-Software-Engineering/testing-python-exercise-wt2425)
6+
- Deadline for submitting this exercise is **Wednesday 22nd January 2025 09:00**.
87

98
## Prerequisites
109

@@ -18,11 +17,11 @@
1817
- [pytest](https://docs.pytest.org/en/6.2.x/getting-started.html#install-pytest)
1918
- [unittest](https://docs.python.org/3/library/unittest.html#module-unittest)
2019
- [coverage](https://coverage.readthedocs.io/en/6.2/#quick-start)
21-
- [tox](https://tox.wiki/en/4.0.15/installation.html)
20+
- [tox](https://tox.wiki/en/4.23.2/installation.html)
2221

2322
## Step 1 - Getting Familiar With the Code
2423

25-
- Fork the [repository](https://github.com/Simulation-Software-Engineering/testing-python-exercise-wt2223).
24+
- Fork the [repository](https://github.com/Simulation-Software-Engineering/testing-python-exercise-wt2425).
2625
- The code in `diffusion2d.py` is in principle the same code used for the Python packaging exercise. The main difference is that now the code has a class `SolveDiffusion2D` which has several member functions.
2726
- Each function name states what the function does, for example the function `initialize_domain()` takes in input arguments `w` (width), `h` (height), `dx` and `dy` and sets the values to member variables of the class and also calculates the number of points in x and y directions.
2827
- The functions `initialize_domain` and `initialize_physical_parameters` have default values for all input parameters, hence they can be called without any parameters.
@@ -51,7 +50,7 @@
5150
- Note that you have the object of the class `SolveDiffusion2D` and hence you can access member variables, for example `solver.nx` and `solver.ny`. This is useful to check the actual values.
5251
- Using a similar workflow, complete the other two unit tests.
5352
- Run the tests using `pytest`.
54-
- It is observed that in some instances `pytest` is not able to find the tests. One reason is the way pytest is installed, which is typically either using `pip` or `apt`. Refer to the [corresponding section](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/python_testing_demo.md#pytest) in the demo for more details. If such errors occur, then try to explicitly point pytest to the relevant test file. For example:
53+
- It is observed that in some instances `pytest` is not able to find the tests. One reason is the way pytest is installed, which is typically either using `pip` or `apt`. Refer to the [corresponding section](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/python_testing_demo.md#pytest) in the demo for more details. If such errors occur, then try to explicitly point pytest to the relevant test file in the following way:
5554

5655
```bash
5756
pytest tests/unit/test_diffusion2d_functions.py
@@ -103,9 +102,9 @@ pytest tests/unit/test_diffusion2d_functions.py
103102

104103
## Step 7 - Automation Using tox
105104

106-
- Write a `tox.ini` file such that by running the command `tox`, both `pytest` and `unittest` are executed.
105+
- Write a `tox.toml` file such that by running the command `tox`, both `pytest` and `unittest` are executed.
107106
- Use the `requirements.txt` file to send all the dependencies information to tox.
108107

109108
## Step 8 - Submission
110109

111-
- Open a pull request titled `Adding tests by <GitLab username>` from your fork to the main repository.
110+
- Open a pull request titled `[your GitLab username] Adding tests` from your fork to the main repository.

0 commit comments

Comments
 (0)