-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unclear testing for query references #95
Comments
Hi Nils, I think the issue is that the test server is not a file server, so it does serve the output files. However, they should be somewhere on your disk. Note that our test config usually includes
which might help in your case. Also, you might want to take a look at owslib to make WPS queries. I've recently added support to retrieve files from the local filesystem for exactly this purpose: geopython/OWSLib#680 HTH |
So the testserver has no store functionality? :-( I realized that the file is created then in the main project folder (next to the makefile). I don't think it is good behaviour and I don't like the idea to rely on this. But thank you for your help anyway. I also tried to run the test against the live server with the owslib: import os
import unittest
import owslib.wps
INPUT_FILE = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'tests',
'buildings.json'
)
URL_WPS = 'http://localhost:5000/wps'
# identifier
IDENTIFIER_PROCESS = 'splitbuildings'
IDENTIFIER_INPUT_BUILDINGS = 'buildings'
IDENTIFIER_INPUT_COUNT = 'count'
IDENTIFIER_OUTPUT = 'splittedbuildings'
COLUMN_AREA_INDEX = 'areaindex'
class TestLiveServer(unittest.TestCase):
def test_building_splitter(self):
wps = owslib.wps.WebProcessingService(URL_WPS, verbose=True)
with open(INPUT_FILE, 'r') as infile:
input_buildings = infile.read()
execution = wps.execute(IDENTIFIER_PROCESS,
inputs=[
(IDENTIFIER_INPUT_BUILDINGS, owslib.wps.ComplexDataInput(
value=input_buildings,
mimeType='application/json'
)),
(IDENTIFIER_INPUT_COUNT, '4'),
],
output=[
(IDENTIFIER_OUTPUT, True),
]
)
wps.monitorExecution(execution)
outfile = gpd.read_file(execution.processOutputs[0].reference)
self.assertTrue(COLUMN_AREA_INDEX in outfile.columns)
if __name__ == '__main__':
unittest.main() (In this case the file is outside of the tests folder, but next to the makefile for the babybird.) I changed the default.cfg file, so that it allows 10 gb requests sizes (just to be sure). After installing and running the babybird application, I get 400 status codes for the post requests (so even on the execution part). |
You should save process results in |
Thx, with the workdir I get rid of the json file in the main project folder (that was created before in the tests). But for making it completely clear for me: At the moment there is no way to get the referenced files by the urls given back from the process within the test case? |
Ok test via owslib works after setting the maxrequestsize option. Still it would be great to handle the reference output in the bird-house-style tests. |
Agreed. Maybe we could bundle a tiny file server... @cehbrecht Is this something you have considered already? |
@huard I have not thought about it. But because we are using But this means we need a running wps ... current pywps tests don't need this. |
Description
Hi there, I try to create a service that gives works on a geojson file.
The basic idea is to split a city (with all buildings) into equal size parts (regarding the number of buildings) and to have the buildings in the clusters to be close to each other.
(It is basically from a task to create surveys for students to check taxonomies).
I can run the code itself in a process.
My main problem is the testing. As my test data set is whole city of Chia, Colombia, I run into troubles regarding to the maximum request size.
For the input data I'm already able to set the config (as it is a global object) in the pws configuration module.
For the output, I can ask the pywps server for giving back a reference.
The stuff I'm really in trouble is to query this reference in the testcase:
The service itself is like this:
When I try to query the url, it doesn't work. (I guess it can be partly because the application may doesn't run on that port; however I haven't seen any documentation on which port it runs then / how to change the url).
As I wrote, I don't know how to really get the result back in the testcase, so that I can check the data after the processing. The testcases I found so far (in the emu repo for example) are all happy with processing literalstrings or with a successful execution of the WPS process, but there was no point in querying the reference urls.
Please help me to understand what I have to do here.
Environment
Steps to Reproduce
Additional Information
The text was updated successfully, but these errors were encountered: