From fbcbd70af62bad71a7296c6a5fc5c81eb6d3275a Mon Sep 17 00:00:00 2001 From: Carl Higgs Date: Tue, 4 Jul 2023 14:31:20 +1000 Subject: [PATCH] attempt to address #340 by restricting max-workers to 1 (in attempt to get more advanced unittests to work in GitHub actions, as parallelisation may be causing problems; have to commit to see if this will work!) --- .github/workflows/tests.yml | 2 ++ process/tests/tests.py | 64 ++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d1ce580c..1c5ed15b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,6 +7,8 @@ jobs: test: name: Run test suite runs-on: ubuntu-latest + strategy: + max-parallel: 1 steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/process/tests/tests.py b/process/tests/tests.py index 53f110a1..16537bd8 100644 --- a/process/tests/tests.py +++ b/process/tests/tests.py @@ -50,35 +50,35 @@ def test_load_example_region(self): codename = 'example_ES_Las_Palmas_2023' r = ghsci.Region(codename) - # def test_example_analysis(self): - # """Analyse example region.""" - # codename = 'example_ES_Las_Palmas_2023' - # r = ghsci.Region(codename) - # r.analysis() - - # def test_example_generate(self): - # """Generate resources for example region.""" - # codename = 'example_ES_Las_Palmas_2023' - # r = ghsci.Region(codename) - # r.generate() - - # def test_sensitivity(self): - # """Test sensitivity analysis of urban intersection parameter.""" - # reference = 'example_ES_Las_Palmas_2023' - # comparison = 'ES_Las_Palmas_2023_test_not_urbanx' - # # create modified version of reference configuration - # with open(f'./configuration/regions/{reference}.yml') as file: - # configuration = file.read() - # configuration = configuration.replace( - # 'ghsl_urban_intersection: true', - # 'ghsl_urban_intersection: false', - # ) - # with open(f'./configuration/regions/{comparison}.yml', 'w') as file: - # file.write(configuration) - # r = ghsci.Region(comparison) - # r.analysis() - # r.generate() - # r.compare(reference) + def test_example_analysis(self): + """Analyse example region.""" + codename = 'example_ES_Las_Palmas_2023' + r = ghsci.Region(codename) + r.analysis() + + def test_example_generate(self): + """Generate resources for example region.""" + codename = 'example_ES_Las_Palmas_2023' + r = ghsci.Region(codename) + r.generate() + + def test_sensitivity(self): + """Test sensitivity analysis of urban intersection parameter.""" + reference = 'example_ES_Las_Palmas_2023' + comparison = 'ES_Las_Palmas_2023_test_not_urbanx' + # create modified version of reference configuration + with open(f'./configuration/regions/{reference}.yml') as file: + configuration = file.read() + configuration = configuration.replace( + 'ghsl_urban_intersection: true', + 'ghsl_urban_intersection: false', + ) + with open(f'./configuration/regions/{comparison}.yml', 'w') as file: + file.write(configuration) + r = ghsci.Region(comparison) + r.analysis() + r.generate() + r.compare(reference) def calculate_line_endings(path): @@ -111,9 +111,9 @@ def suite(): 'test_global_indicators_shell', 'test_project_setup', 'test_load_example_region', - # 'test_example_analysis', - # 'test_example_generate', - # 'test_sensitivity', + 'test_example_analysis', + 'test_example_generate', + 'test_sensitivity', ]: suite.addTest(tests(t)) return suite