Skip to content

Commit

Permalink
attempt to address #340 by restricting max-workers to 1 (in attempt t…
Browse files Browse the repository at this point in the history
…o get more advanced unittests to work in GitHub actions, as parallelisation may be causing problems; have to commit to see if this will work!)
  • Loading branch information
carlhiggs committed Jul 4, 2023
1 parent 3705e22 commit fbcbd70
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 32 additions & 32 deletions process/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fbcbd70

Please sign in to comment.