From b8766db736fa62bb3720b861b45ade95e9937beb Mon Sep 17 00:00:00 2001 From: Cap Date: Fri, 26 Dec 2025 14:12:20 +0100 Subject: [PATCH 1/7] Tests with cov --- .github/workflows/install-and-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/install-and-test.yml b/.github/workflows/install-and-test.yml index 9a47936..7805cd3 100644 --- a/.github/workflows/install-and-test.yml +++ b/.github/workflows/install-and-test.yml @@ -53,6 +53,10 @@ jobs: python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics shell: bash -el {0} + + - name: Just see where we are + run: ls + shell: bash -el {0} - name: Test with pytest run: pytest --cov --log-cli-level INFO --clear_inputs --cov-report xml From 84c0a2518e9005d2e458cc16d8f030d153e9e68b Mon Sep 17 00:00:00 2001 From: Cap Date: Fri, 26 Dec 2025 14:42:35 +0100 Subject: [PATCH 2/7] Update .coveragerc --- .coveragerc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.coveragerc b/.coveragerc index 8b13789..a18fd12 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1 +1,2 @@ - +[coverage:run] +source = mobility From 8be6a1413f1ed47880a317364a696f0d017f2c92 Mon Sep 17 00:00:00 2001 From: Cap Date: Fri, 26 Dec 2025 15:02:39 +0100 Subject: [PATCH 3/7] Update pyproject.toml --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dd0399e..da7d559 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ classifiers = [ [project.optional-dependencies] dev = [ + "coverage", "flake8", "pytest", "pytest-cov", @@ -78,4 +79,4 @@ mobility = [ [tool.setuptools.packages.find] where = ["."] include = ["mobility*"] -exclude = ["certs", "certs.*"] \ No newline at end of file +exclude = ["certs", "certs.*"] From aac3b57692544ed078a7c76b9bf649b03ec24f0e Mon Sep 17 00:00:00 2001 From: Cap Date: Fri, 26 Dec 2025 15:22:37 +0100 Subject: [PATCH 4/7] Update install-and-test.yml --- .github/workflows/install-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install-and-test.yml b/.github/workflows/install-and-test.yml index 7805cd3..72b99d7 100644 --- a/.github/workflows/install-and-test.yml +++ b/.github/workflows/install-and-test.yml @@ -59,7 +59,7 @@ jobs: shell: bash -el {0} - name: Test with pytest - run: pytest --cov --log-cli-level INFO --clear_inputs --cov-report xml + run: pytest --cov --log-cli-level INFO --clear_inputs --cov-report json shell: bash -el {0} - name: Upload coverage reports to Codecov From 4e097815ada88c72ae58103cb4b9c4551f877280 Mon Sep 17 00:00:00 2001 From: Cap Date: Fri, 26 Dec 2025 15:32:47 +0100 Subject: [PATCH 5/7] Update install-and-test.yml --- .github/workflows/install-and-test.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/install-and-test.yml b/.github/workflows/install-and-test.yml index 72b99d7..66971c0 100644 --- a/.github/workflows/install-and-test.yml +++ b/.github/workflows/install-and-test.yml @@ -53,14 +53,10 @@ jobs: python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics shell: bash -el {0} - - - name: Just see where we are - run: ls - shell: bash -el {0} - name: Test with pytest - run: pytest --cov --log-cli-level INFO --clear_inputs --cov-report json + run: pytest --cov --log-cli-level INFO --clear_inputs --cov-report xml shell: bash -el {0} - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 From cf74b287f402e34839091d631184e5efc2dc61e4 Mon Sep 17 00:00:00 2001 From: Cap Date: Mon, 29 Dec 2025 12:01:55 +0100 Subject: [PATCH 6/7] Create test_901_ensure_quickstart_works.py --- .../test_901_ensure_quickstart_works.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/back/integration/test_901_ensure_quickstart_works.py diff --git a/tests/back/integration/test_901_ensure_quickstart_works.py b/tests/back/integration/test_901_ensure_quickstart_works.py new file mode 100644 index 0000000..779bafe --- /dev/null +++ b/tests/back/integration/test_901_ensure_quickstart_works.py @@ -0,0 +1,33 @@ +import os +import dotenv + +import mobility + +dotenv.load_dotenv() + +# Using Foix (a small town) and a limited radius for quick results +transport_zones = mobility.TransportZones("fr-09122", radius = 10) + +# Using EMP, the latest national mobility survey for France +emp = mobility.EMPMobilitySurvey() + +# Creating a synthetic population of 1000 for the area +pop = mobility.Population(transport_zones, sample_size = 1000) + +# Simulating the trips for this population for three modes : car, walk and bicyle, and only home and work motives (OtherMotive is mandatory) +pop_trips = mobility.PopulationTrips( + pop, + [mobility.CarMode(transport_zones), mobility.WalkMode(transport_zones), mobility.BicycleMode(transport_zones)], + [mobility.HomeMotive(), mobility.WorkMotive(), mobility.OtherMotive(population=pop)], + [emp] + ) + +# You can get the weekday trips to inspect them +weekday_flows = pop_trips.get()["weekday_flows"].collect() + +# You can can also get global metrics that will be compared to the theoetical values for this population +global_metrics = pop_trips.evaluate("global_metrics") + +# You can also plot the flows, with labels for the cities that are bigger than their neighbours +labels = pop_trips.get_prominent_cities() +pop_trips.plot_od_flows(labels=labels) From 9a8ecd83ae6b3b3eb8ff3528275e8d34f30fae61 Mon Sep 17 00:00:00 2001 From: Cap Date: Mon, 29 Dec 2025 13:55:22 +0100 Subject: [PATCH 7/7] Update test_901_ensure_quickstart_works.py --- tests/back/integration/test_901_ensure_quickstart_works.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/back/integration/test_901_ensure_quickstart_works.py b/tests/back/integration/test_901_ensure_quickstart_works.py index 779bafe..2fa1193 100644 --- a/tests/back/integration/test_901_ensure_quickstart_works.py +++ b/tests/back/integration/test_901_ensure_quickstart_works.py @@ -19,7 +19,8 @@ pop, [mobility.CarMode(transport_zones), mobility.WalkMode(transport_zones), mobility.BicycleMode(transport_zones)], [mobility.HomeMotive(), mobility.WorkMotive(), mobility.OtherMotive(population=pop)], - [emp] + [emp], + n_iterations=1 ) # You can get the weekday trips to inspect them