Skip to content

Commit 2549fda

Browse files
authored
Adds code to introduce compiled RAT code as a submodule (#18)
* Adds code to introduce compiled RAT code as a submodule * Updates tests for latest version of pydantic * Updates requirements.txt * Updates github actions to pull submodule automatically
1 parent 7f2ad53 commit 2549fda

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

.github/workflows/runTests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121
runs-on: ${{ matrix.os }}
2222

2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
25+
with:
26+
submodules: true
2527
- name: Set up Python version ${{ matrix.version }}
2628
uses: actions/setup-python@v4
2729
with:

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "cpp/RAT"]
2+
path = cpp/RAT
3+
url = https://github.com/RascalSoftware/RAT/tree/generated_source

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This project targets Python 3.9 or later. Install an appropriate version of Pyth
99

1010
Then create a fork of the python-RAT repo, and clone the fork
1111

12-
git clone https://github.com/<username>/python-RAT.git
12+
git clone --recurse-submodules https://github.com/<username>/python-RAT.git
1313
cd python-RAT
1414

1515
And finally create a separate branch to begin work

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
numpy >= 1.20
22
prettytable >= 3.9.0
3-
pydantic >= 2.4.0
3+
pydantic >= 2.4.2
44
pytest >= 7.4.0
55
pytest-cov >= 4.1.0
66
StrEnum >= 0.4.15

tests/test_models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,23 @@ def test_default_names(model: Callable, model_name: str) -> None:
4949
class TestModels(object):
5050
def test_initialise_with_wrong_type(self, model: Callable) -> None:
5151
"""When initialising a model with the wrong type for the "name" field, we should raise a ValidationError."""
52-
with pytest.raises(pydantic.ValidationError, match='Input should be a valid string'):
52+
with pytest.raises(pydantic.ValidationError, match=f'1 validation error for {model.__name__}\nname\n Input should be a valid string'):
5353
model(name=1)
5454

5555
def test_assignment_with_wrong_type(self, model: Callable) -> None:
5656
"""When assigning the "name" field of a model with the wrong type, we should raise a ValidationError."""
5757
test_model = model()
58-
with pytest.raises(pydantic.ValidationError, match='Input should be a valid string'):
58+
with pytest.raises(pydantic.ValidationError, match=f'1 validation error for {model.__name__}\nname\n Input should be a valid string'):
5959
test_model.name = 1
6060

6161
def test_initialise_with_zero_length_name(self, model: Callable) -> None:
6262
"""When initialising a model with a zero length name, we should raise a ValidationError."""
63-
with pytest.raises(pydantic.ValidationError, match='String should have at least 1 characters'):
63+
with pytest.raises(pydantic.ValidationError, match=f'1 validation error for {model.__name__}\nname\n String should have at least 1 character'):
6464
model(name='')
6565

6666
def test_initialise_with_extra_fields(self, model: Callable) -> None:
6767
"""When initialising a model with unspecified fields, we should raise a ValidationError."""
68-
with pytest.raises(pydantic.ValidationError, match='Extra inputs are not permitted'):
68+
with pytest.raises(pydantic.ValidationError, match=f'1 validation error for {model.__name__}\nnew_field\n Extra inputs are not permitted'):
6969
model(new_field=1)
7070

7171

0 commit comments

Comments
 (0)