• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geopython / pywps / 4027556941

pending completion
4027556941

push

github

GitHub
fixed tox.ini parameter passenv (#670)

5172 of 6354 relevant lines covered (81.4%)

0.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/tests/processes/__init__.py
1
##################################################################
2
# Copyright 2018 Open Source Geospatial Foundation and others    #
3
# licensed under MIT, Please consult LICENSE.txt for details     #
4
##################################################################
5

6
from pywps import Process
1✔
7
from pywps.inout import LiteralInput, LiteralOutput, BoundingBoxInput, BoundingBoxOutput
1✔
8
from pywps.inout.literaltypes import ValuesReference
1✔
9

10

11
class SimpleProcess(Process):
1✔
12
    identifier = "simpleprocess"
1✔
13

14
    def __init__(self):
1✔
15
        self.add_input(LiteralInput())
×
16

17

18
class UltimateQuestion(Process):
1✔
19
    def __init__(self):
1✔
20
        super(UltimateQuestion, self).__init__(
×
21
            self._handler,
22
            identifier='ultimate_question',
23
            title='Ultimate Question',
24
            outputs=[LiteralOutput('outvalue', 'Output Value', data_type='string')])
25

26
    @staticmethod
1✔
27
    def _handler(request, response):
×
28
        response.outputs['outvalue'].data = '42'
×
29
        return response
×
30

31

32
class Greeter(Process):
1✔
33
    def __init__(self):
1✔
34
        super(Greeter, self).__init__(
1✔
35
            self.greeter,
36
            identifier='greeter',
37
            title='Greeter',
38
            inputs=[LiteralInput('name', 'Input name', data_type='string')],
39
            outputs=[LiteralOutput('message', 'Output message', data_type='string')]
40
        )
41

42
    @staticmethod
1✔
43
    def greeter(request, response):
×
44
        name = request.inputs['name'][0].data
×
45
        assert type(name) is str
×
46
        response.outputs['message'].data = "Hello {}!".format(name)
×
47
        return response
×
48

49

50
class InOut(Process):
1✔
51
    def __init__(self):
1✔
52
        super(InOut, self).__init__(
1✔
53
            self.inout,
54
            identifier='inout',
55
            title='In and Out',
56
            inputs=[
57
                LiteralInput('string', 'String', data_type='string'),
58
                LiteralInput('time', 'Time', data_type='time',
59
                             default='12:00:00'),
60
                LiteralInput('ref_value', 'Referenced Value', data_type='string',
61
                    allowed_values=ValuesReference(reference="https://en.wikipedia.org/w/api.php?action=opensearch&search=scotland&format=json"),  # noqa
62
                    default='Scotland',),
63
            ],
64
            outputs=[
65
                LiteralOutput('string', 'Output', data_type='string')
66
            ]
67
        )
68

69
    @staticmethod
1✔
70
    def inout(request, response):
×
71
        a_string = request.inputs['string'][0].data
×
72
        response.outputs['string'].data = "".format(a_string)
×
73
        return response
×
74

75

76
class BBox(Process):
1✔
77
    def __init__(self):
1✔
78
        super(BBox, self).__init__(
1✔
79
            self.bbox,
80
            identifier='bbox_test',
81
            title='BBox Test',
82
            inputs=[
83
                BoundingBoxInput(
84
                    'area',
85
                    'An area',
86
                    abstract='Define the area of interest',
87
                    crss=['epsg:4326', 'epsg:3857'],
88
                    min_occurs=1,
89
                    max_occurs=1
90
                ),
91
            ],
92
            outputs=[
93
                BoundingBoxOutput('extent', 'Extent', crss=['epsg:4326', 'epsg:3857'])
94
            ]
95
        )
96

97
    @staticmethod
1✔
98
    def bbox(request, response):
×
99
        area = request.inputs['area'][0].data
×
100
        response.outputs['extent'].data = area
×
101
        return response
×
102

103

104
class Sleep(Process):
1✔
105
    """A long running process, just sleeping."""
106
    def __init__(self):
1✔
107
        inputs = [
1✔
108
            LiteralInput('seconds', title='Seconds', data_type='float')
109
        ]
110
        outputs = [
1✔
111
            LiteralOutput('finished', title='Finished', data_type='boolean')
112
        ]
113

114
        super(Sleep, self).__init__(
1✔
115
            self._handler,
116
            identifier='sleep',
117
            title='Sleep',
118
            abstract='Wait for specified number of seconds.',
119
            inputs=inputs,
120
            outputs=outputs,
121
            store_supported=True,
122
            status_supported=True
123
        )
124

125
    @staticmethod
1✔
126
    def _handler(request, response):
×
127
        import time
×
128

129
        seconds = request.inputs['seconds'][0].data
×
130
        step = seconds / 3
×
131
        for i in range(3):
×
132
            response.update_status('Sleep in progress...', i / 3 * 100)
×
133
            time.sleep(step)
×
134

135
        response.outputs['finished'].data = "True"
×
136
        return response
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc