misc: pylint fix function-redefined (#52630)

This commit is contained in:
Lauréline Guérin 2021-04-02 15:13:56 +02:00
parent c80d8dc224
commit fd7b28c05a
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 15 additions and 46 deletions

View File

@ -272,11 +272,6 @@ def test_json_datasource(pub, requests_pub, http_requests):
# same with django templated url # same with django templated url
get_request().datasources_cache = {} get_request().datasources_cache = {}
class JsonUrlPath:
def get_substitution_variables(self):
return {'json_url': 'file://%s' % json_file_path}
pub.substitutions.feed(JsonUrlPath()) pub.substitutions.feed(JsonUrlPath())
datasource = {'type': 'json', 'value': '{{ json_url }}'} datasource = {'type': 'json', 'value': '{{ json_url }}'}
assert data_sources.get_items(datasource) == [ assert data_sources.get_items(datasource) == [
@ -286,11 +281,6 @@ def test_json_datasource(pub, requests_pub, http_requests):
# json specified with a variadic url with an erroneous space # json specified with a variadic url with an erroneous space
get_request().datasources_cache = {} get_request().datasources_cache = {}
class JsonUrlPath:
def get_substitution_variables(self):
return {'json_url': 'file://%s' % json_file_path}
pub.substitutions.feed(JsonUrlPath()) pub.substitutions.feed(JsonUrlPath())
datasource = {'type': 'json', 'value': ' [json_url]'} datasource = {'type': 'json', 'value': ' [json_url]'}
assert data_sources.get_items(datasource) == [ assert data_sources.get_items(datasource) == [
@ -300,11 +290,6 @@ def test_json_datasource(pub, requests_pub, http_requests):
# same with django templated url # same with django templated url
get_request().datasources_cache = {} get_request().datasources_cache = {}
class JsonUrlPath:
def get_substitution_variables(self):
return {'json_url': 'file://%s' % json_file_path}
pub.substitutions.feed(JsonUrlPath()) pub.substitutions.feed(JsonUrlPath())
datasource = {'type': 'json', 'value': ' {{ json_url }}'} datasource = {'type': 'json', 'value': ' {{ json_url }}'}
assert data_sources.get_items(datasource) == [ assert data_sources.get_items(datasource) == [
@ -629,11 +614,6 @@ def test_geojson_datasource(pub, requests_pub, http_requests):
# same with django templated url # same with django templated url
get_request().datasources_cache = {} get_request().datasources_cache = {}
class GeoJSONUrlPath:
def get_substitution_variables(self):
return {'geojson_url': 'file://%s' % geojson_file_path}
pub.substitutions.feed(GeoJSONUrlPath()) pub.substitutions.feed(GeoJSONUrlPath())
datasource = {'type': 'geojson', 'value': '{{ geojson_url }}'} datasource = {'type': 'geojson', 'value': '{{ geojson_url }}'}
assert data_sources.get_items(datasource) == [ assert data_sources.get_items(datasource) == [
@ -653,11 +633,6 @@ def test_geojson_datasource(pub, requests_pub, http_requests):
# geojson specified with a variadic url with an erroneous space # geojson specified with a variadic url with an erroneous space
get_request().datasources_cache = {} get_request().datasources_cache = {}
class GeoJSONUrlPath:
def get_substitution_variables(self):
return {'geojson_url': 'file://%s' % geojson_file_path}
pub.substitutions.feed(GeoJSONUrlPath()) pub.substitutions.feed(GeoJSONUrlPath())
datasource = {'type': 'geojson', 'value': ' [geojson_url]'} datasource = {'type': 'geojson', 'value': ' [geojson_url]'}
assert data_sources.get_items(datasource) == [ assert data_sources.get_items(datasource) == [
@ -677,11 +652,6 @@ def test_geojson_datasource(pub, requests_pub, http_requests):
# same with django templated url # same with django templated url
get_request().datasources_cache = {} get_request().datasources_cache = {}
class GeoJSONUrlPath:
def get_substitution_variables(self):
return {'geojson_url': 'file://%s' % geojson_file_path}
pub.substitutions.feed(GeoJSONUrlPath()) pub.substitutions.feed(GeoJSONUrlPath())
datasource = {'type': 'geojson', 'value': ' {{ geojson_url }}'} datasource = {'type': 'geojson', 'value': ' {{ geojson_url }}'}
assert data_sources.get_items(datasource) == [ assert data_sources.get_items(datasource) == [

View File

@ -2,11 +2,10 @@
import io import io
import json import json
import shutil import os
import mock import mock
import pytest import pytest
from quixote import cleanup
from wcs import fields from wcs import fields
from wcs.data_sources import NamedDataSource, build_agenda_datasources, collect_agenda_data from wcs.data_sources import NamedDataSource, build_agenda_datasources, collect_agenda_data
@ -14,29 +13,29 @@ from wcs.formdef import FormDef
from wcs.qommon.http_request import HTTPRequest from wcs.qommon.http_request import HTTPRequest
from wcs.qommon.misc import ConnectionError from wcs.qommon.misc import ConnectionError
from .utilities import create_temporary_pub from .utilities import clean_temporary_pub, create_temporary_pub
def setup_module(module):
cleanup()
global pub
pub = create_temporary_pub()
pub.cfg['debug'] = {'logger': True}
pub.write_cfg()
pub.set_config()
def teardown_module(module): def teardown_module(module):
shutil.rmtree(pub.APP_DIR) clean_temporary_pub()
@pytest.fixture @pytest.fixture
def pub(request): def pub(request):
req = HTTPRequest(None, {'SERVER_NAME': 'example.net', 'SCRIPT_NAME': ''}) pub = create_temporary_pub()
req = HTTPRequest(None, {'SCRIPT_NAME': '/', 'SERVER_NAME': 'example.net'})
pub.set_app_dir(req) pub.set_app_dir(req)
pub._set_request(req) pub._set_request(req)
open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w').write(
'''
[debug]
logger=true
'''
)
pub.load_site_options()
return pub return pub