Skip to content

Commit 89ae559

Browse files
authored
Merge branch 'main' into fix/replace-print-with-logging-repo-load-controller
2 parents 6ba24d6 + 946abed commit 89ae559

File tree

6 files changed

+67
-3
lines changed

6 files changed

+67
-3
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Functional tests"
2+
# Runs automated test suites that ensure functionality is preserved. Any failures should prevent code from shipping.
3+
on:
4+
pull_request:
5+
branches: [main, release]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
test:
12+
name: test with ${{ matrix.env }} on ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
timeout-minutes: 15
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
env: ["3.10", "3.11"] #, "3.12", "3.13", "3.14"
19+
os: [ubuntu-latest, macos-latest]
20+
steps:
21+
- uses: actions/checkout@v5
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v7
24+
with:
25+
enable-cache: true
26+
27+
- name: Run Tests
28+
run: |
29+
uv run --python ${{ matrix.env }} pytest \
30+
tests/test_classes \
31+
--color=yes

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ confidence=HIGH,
142142

143143
# Only enable specific messages
144144
disable=all
145-
enable=unused-import,redefined-outer-name,E1206,E1205,E0704,E0107,E4702,E1101,E0211,E0213,E0103,E1133,E1120,E3102,E0602,E1123,E0001,W0702,W1404,W0706,W0101,W0120,W0718,R1737,R1705,R1720,R1724,R1723,R0401,R1701,C1802,C0200,C0501,C0201,W1001,E1102,R0923
145+
enable=unused-import,redefined-outer-name,E1206,E1205,E0704,E0107,E4702,E1101,E0211,E0213,E0103,E1133,E1120,E3102,E0602,E1123,E0001,W0702,W1404,W0706,W0101,W0120,W0718,R1737,R1724,R1723,R0401,R1701,C1802,C0200,C0501,C0201,W1001,E1102,R0923
146146

147147

148148
[LOGGING]

augur/application/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,8 @@ class JsonConfig(ConfigStore):
546546

547547
def __init__(self, json_data, logger: logging.Logger):
548548
super().__init__(logger)
549+
if not self.writable:
550+
json_data = copy.deepcopy(json_data)
549551
self.json_data = json_data
550552

551553
@property

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,19 @@ legacy_tox_ini = """
187187
addopts = -ra -s
188188
"""
189189

190+
[tool.pytest.ini_options]
191+
addopts = "-ra -s"
192+
testpaths = [
193+
"tests/test_classes",
194+
# "tests/test_routes", # runs, but needs a fixture for connecting to the web interface of Augur
195+
# "tests/test_metrics",
196+
# "tests/test_tasks",
197+
# "tests/test_application",
198+
# "tests/test_workers",
199+
# "tests/test_workers/worker_persistence/",
200+
# "tests/test_routes/runner.py"
201+
]
202+
190203
[tool.mypy]
191204
files = ['augur/application/db/*.py']
192205
ignore_missing_imports = true

scripts/control/refresh-matviews.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ psql -U augur -h localhost -p 5432 -d padres -c 'REFRESH MATERIALIZED VIEW augur
66
psql -U augur -h localhost -p 5432 -d padres -c 'REFRESH MATERIALIZED VIEW augur_data.augur_new_contributors with data;'
77
psql -U augur -h localhost -p 5432 -d padres -c 'REFRESH MATERIALIZED VIEW augur_data.explorer_contributor_actions with data;'
88
psql -U augur -h localhost -p 5432 -d padres -c 'REFRESH MATERIALIZED VIEW augur_data.explorer_libyear_all with data;'
9-
psql -U augur -h localhost -p 5432 -d padres -c 'REFRESH MATERIALIZED VIEW augur_data.explorer_libyear_detail with data;'
109
psql -U augur -h localhost -p 5432 -d padres -c 'REFRESH MATERIALIZED VIEW augur_data.explorer_new_contributors with data;'
1110
psql -U augur -h localhost -p 5432 -d padres -c 'REFRESH MATERIALIZED VIEW augur_data.explorer_entry_list with data;'

tests/test_classes/test_config_stores.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,31 @@ def test_jsonconfig_empty_true_false(mock_logger):
2525
assert JsonConfig({"A": {}}, mock_logger).empty is False
2626

2727

28+
def test_jsonconfig_write_protection(mock_logger):
29+
# JsonConfig should be not writeable by default, so we should be unable to change
30+
# its values, even by abusing references
31+
32+
data = {"Alpha": {"a": 1, "b": "str"}, "Beta": {}}
33+
cfg = JsonConfig(data, mock_logger)
34+
35+
# mutation via input
36+
data["Alpha"]["a"] = 2
37+
38+
config_test = cfg.retrieve_dict()
39+
assert config_test != data # the data in the config should not change
40+
41+
# mutation via output
42+
config_test["Alpha"]["a"] = 3
43+
44+
config_test = cfg.retrieve_dict()
45+
assert config_test != data # the data in the config should not change
46+
2847
def test_jsonconfig_retrieve_has_get(mock_logger):
2948
data = {"Alpha": {"a": 1, "b": "str"}, "Beta": {}}
3049
cfg = JsonConfig(data, mock_logger)
3150

3251
# retrieve full dict
33-
assert cfg.retrieve_dict() is data
52+
assert cfg.retrieve_dict() == data
3453

3554
# has/get section
3655
assert cfg.has_section("Alpha") is True

0 commit comments

Comments
 (0)