Skip to content

Commit 0498e9b

Browse files
fix: repair tests of parallel validation
1 parent bc27f9b commit 0498e9b

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "testing",
3+
"resources": [
4+
{
5+
"name": "data",
6+
"path": "data.csv",
7+
"schema": {
8+
"fields": [
9+
{
10+
"name": "id",
11+
"type": "string",
12+
"constraints": {
13+
"required": true
14+
}
15+
},
16+
{
17+
"name": "name",
18+
"type": "string"
19+
},
20+
{
21+
"name": "description",
22+
"type": "string"
23+
},
24+
{
25+
"name": "amount",
26+
"type": "number"
27+
}
28+
],
29+
"primaryKey": "id"
30+
}
31+
},
32+
{
33+
"name": "data2",
34+
"path": "data2.csv",
35+
"schema": {
36+
"fields": [
37+
{
38+
"type": "string",
39+
"name": "parent"
40+
},
41+
{
42+
"type": "string",
43+
"name": "comment"
44+
}
45+
]
46+
}
47+
}
48+
]
49+
}

frictionless/validator/__spec__/package/test_parallel.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@
66

77
# General
88

9+
# Note: to test parallel validation, do not use foreign keys to prevent an
10+
# automatic fallback on single-core execution
11+
912

1013
@pytest.mark.ci
1114
def test_package_validate_parallel_from_dict():
12-
with open("data/package/datapackage.json") as file:
13-
package = Package(json.load(file), basepath="data/package")
15+
with open("data/datapackage.json") as file:
16+
package = Package(json.load(file), basepath="data")
1417
report = package.validate(parallel=True)
1518
assert report.valid
1619

1720

1821
@pytest.mark.ci
1922
def test_package_validate_parallel_from_dict_invalid():
20-
with open("data/invalid/datapackage.json") as file:
23+
with open("data/invalid/datapackage_no_foreign_key.json") as file:
2124
package = Package(json.load(file), basepath="data/invalid")
2225
report = package.validate(parallel=True)
2326
assert report.flatten(["taskNumber", "rowNumber", "fieldNumber", "type"]) == [
@@ -29,7 +32,7 @@ def test_package_validate_parallel_from_dict_invalid():
2932

3033
@pytest.mark.ci
3134
def test_package_validate_with_parallel():
32-
package = Package("data/invalid/datapackage.json")
35+
package = Package("data/invalid/datapackage_no_foreign_key.json")
3336
report = package.validate(parallel=True)
3437
assert report.flatten(["taskNumber", "rowNumber", "fieldNumber", "type"]) == [
3538
[1, 3, None, "blank-row"],

0 commit comments

Comments
 (0)