Projet

Général

Profil

0015-misc-pylint-fix-function-redefined-52630.patch

Lauréline Guérin, 02 avril 2021 17:21

Télécharger (4,8 ko)

Voir les différences:

Subject: [PATCH 15/18] misc: pylint fix function-redefined (#52630)

 tests/test_datasource.py        | 30 ------------------------------
 tests/test_datasource_chrono.py | 31 +++++++++++++++----------------
 2 files changed, 15 insertions(+), 46 deletions(-)
tests/test_datasource.py
272 272

  
273 273
    # same with django templated url
274 274
    get_request().datasources_cache = {}
275

  
276
    class JsonUrlPath:
277
        def get_substitution_variables(self):
278
            return {'json_url': 'file://%s' % json_file_path}
279

  
280 275
    pub.substitutions.feed(JsonUrlPath())
281 276
    datasource = {'type': 'json', 'value': '{{ json_url }}'}
282 277
    assert data_sources.get_items(datasource) == [
......
286 281

  
287 282
    # json specified with a variadic url with an erroneous space
288 283
    get_request().datasources_cache = {}
289

  
290
    class JsonUrlPath:
291
        def get_substitution_variables(self):
292
            return {'json_url': 'file://%s' % json_file_path}
293

  
294 284
    pub.substitutions.feed(JsonUrlPath())
295 285
    datasource = {'type': 'json', 'value': ' [json_url]'}
296 286
    assert data_sources.get_items(datasource) == [
......
300 290

  
301 291
    # same with django templated url
302 292
    get_request().datasources_cache = {}
303

  
304
    class JsonUrlPath:
305
        def get_substitution_variables(self):
306
            return {'json_url': 'file://%s' % json_file_path}
307

  
308 293
    pub.substitutions.feed(JsonUrlPath())
309 294
    datasource = {'type': 'json', 'value': ' {{ json_url }}'}
310 295
    assert data_sources.get_items(datasource) == [
......
629 614

  
630 615
    # same with django templated url
631 616
    get_request().datasources_cache = {}
632

  
633
    class GeoJSONUrlPath:
634
        def get_substitution_variables(self):
635
            return {'geojson_url': 'file://%s' % geojson_file_path}
636

  
637 617
    pub.substitutions.feed(GeoJSONUrlPath())
638 618
    datasource = {'type': 'geojson', 'value': '{{ geojson_url }}'}
639 619
    assert data_sources.get_items(datasource) == [
......
653 633

  
654 634
    # geojson specified with a variadic url with an erroneous space
655 635
    get_request().datasources_cache = {}
656

  
657
    class GeoJSONUrlPath:
658
        def get_substitution_variables(self):
659
            return {'geojson_url': 'file://%s' % geojson_file_path}
660

  
661 636
    pub.substitutions.feed(GeoJSONUrlPath())
662 637
    datasource = {'type': 'geojson', 'value': ' [geojson_url]'}
663 638
    assert data_sources.get_items(datasource) == [
......
677 652

  
678 653
    # same with django templated url
679 654
    get_request().datasources_cache = {}
680

  
681
    class GeoJSONUrlPath:
682
        def get_substitution_variables(self):
683
            return {'geojson_url': 'file://%s' % geojson_file_path}
684

  
685 655
    pub.substitutions.feed(GeoJSONUrlPath())
686 656
    datasource = {'type': 'geojson', 'value': ' {{ geojson_url }}'}
687 657
    assert data_sources.get_items(datasource) == [
tests/test_datasource_chrono.py
2 2

  
3 3
import io
4 4
import json
5
import shutil
5
import os
6 6

  
7 7
import mock
8 8
import pytest
9
from quixote import cleanup
10 9

  
11 10
from wcs import fields
12 11
from wcs.data_sources import NamedDataSource, build_agenda_datasources, collect_agenda_data
......
14 13
from wcs.qommon.http_request import HTTPRequest
15 14
from wcs.qommon.misc import ConnectionError
16 15

  
17
from .utilities import create_temporary_pub
18

  
19

  
20
def setup_module(module):
21
    cleanup()
22

  
23
    global pub
24

  
25
    pub = create_temporary_pub()
26
    pub.cfg['debug'] = {'logger': True}
27
    pub.write_cfg()
28
    pub.set_config()
16
from .utilities import clean_temporary_pub, create_temporary_pub
29 17

  
30 18

  
31 19
def teardown_module(module):
32
    shutil.rmtree(pub.APP_DIR)
20
    clean_temporary_pub()
33 21

  
34 22

  
35 23
@pytest.fixture
36 24
def pub(request):
37
    req = HTTPRequest(None, {'SERVER_NAME': 'example.net', 'SCRIPT_NAME': ''})
25
    pub = create_temporary_pub()
26
    req = HTTPRequest(None, {'SCRIPT_NAME': '/', 'SERVER_NAME': 'example.net'})
38 27
    pub.set_app_dir(req)
39 28
    pub._set_request(req)
29

  
30
    open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w').write(
31
        '''
32
[debug]
33
logger=true
34
'''
35
    )
36

  
37
    pub.load_site_options()
38

  
40 39
    return pub
41 40

  
42 41

  
43
-