Skip to content

Commit ec72c99

Browse files
committed
Improve testing code coverage
1 parent 985a280 commit ec72c99

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
// "forwardPorts": [],
4242

4343
// Use 'postCreateCommand' to run commands after the container is created.
44-
"postCreateCommand": "pip3 install --user -e .[test]",
44+
"postCreateCommand": "pip3 install --user -e .[develop]",
4545

4646
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
4747
"remoteUser": "vscode"

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@
9898
],
9999
"python.analysis.typeCheckingMode": "basic",
100100
"python.testing.pytestArgs": [
101-
"tests"
101+
"--cov=servicex",
102+
"tests"
102103
],
103104
"python.testing.unittestEnabled": false,
104105
"python.testing.pytestEnabled": true,

servicex/servicex_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@
4545
logger = logging.getLogger(__name__)
4646

4747

48-
def deliver(config: ServiceXSpec):
48+
def deliver(config: ServiceXSpec, config_path=None):
4949
def get_codegen(_sample: Sample, _general: General):
5050
if _sample.Codegen:
5151
return _sample.Codegen
5252
else:
5353
return _general.Codegen
5454

55-
sx = ServiceXClient(backend=config.General.ServiceX)
55+
sx = ServiceXClient(backend=config.General.ServiceX, config_path=config_path)
5656
datasets = []
5757
for sample in config.Sample:
5858
if sample.Query:

tests/test_databinder.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from unittest.mock import patch
23
from pydantic import ValidationError
34

45
from servicex import ServiceXSpec, FileListDataset, RucioDatasetIdentifier
@@ -150,3 +151,23 @@ def test_invalid_dataset_identifier():
150151
]
151152
)
152153
)
154+
155+
156+
def test_string_query(transformed_result):
157+
from servicex import deliver
158+
spec = ServiceXSpec.model_validate({
159+
"General": {
160+
"ServiceX": "testing4",
161+
"Codegen": "uproot-raw",
162+
},
163+
"Sample": [
164+
{
165+
"Name": "sampleA",
166+
"RucioDID": "user.ivukotic:user.ivukotic.single_top_tW__nominal",
167+
"Query": "[{'treename': 'nominal'}]"
168+
}
169+
]
170+
})
171+
with patch('servicex.dataset_group.DatasetGroup.as_files',
172+
return_value=[transformed_result]):
173+
deliver(spec, config_path='tests/example_config.yaml')

0 commit comments

Comments
 (0)