Skip to content

Commit

Permalink
Merge pull request #540 from girder/reduce-warnings
Browse files Browse the repository at this point in the history
Reduce warnings.
  • Loading branch information
manthey authored Jan 26, 2021
2 parents 6f470dd + 848bea5 commit baeeaaf
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
7 changes: 5 additions & 2 deletions girder/test_girder/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ def unavailableWorker(db):
@pytest.fixture(scope='session')
def girderWorkerProcess():
broker = 'amqp://[email protected]'
backend = 'rpc://[email protected]'
env = os.environ.copy()
env['C_FORCE_ROOT'] = 'true'
proc = subprocess.Popen([
'celery', '-A', 'girder_worker.app', 'worker', '--broker', broker, '--concurrency=1'],
'celery', '-A', 'girder_worker.app', 'worker', '--broker', broker,
'--result-backend', backend, '--concurrency=1'],
close_fds=True, env=env)
yield True
proc.terminate()
Expand All @@ -46,8 +48,9 @@ def girderWorker(db, girderWorkerProcess):
service must be running.
"""
broker = 'amqp://[email protected]'
backend = 'rpc://[email protected]'
Setting().set(WorkerSettings.BROKER, broker)
Setting().set(WorkerSettings.BACKEND, broker)
Setting().set(WorkerSettings.BACKEND, backend)
yield True
Setting().unset(WorkerSettings.BROKER)
Setting().unset(WorkerSettings.BACKEND)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exclude =
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D200,D205,D400,D401,E741,W504

[tool:pytest]
addopts = --verbose --strict --showlocals --cov-report="term" --cov-report="xml" --cov
addopts = --verbose --strict-markers --showlocals --cov-report="term" --cov-report="xml" --cov
cache_dir = build/pytest_cache
testpaths = test girder/test_girder girder_annotation/test_annotation

Expand Down
20 changes: 10 additions & 10 deletions sources/gdal/large_image_source_gdal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ def _initWithProjection(self, unitsPerPixel=None):
# between -180,0 and +180,0 is used. Some projections (such as
# stereographic) will fail in this case; they must have a
# unitsPerPixel specified.
equator = pyproj.transform(inProj, outProj, [-180, 180], [0, 0], always_xy=True)
equator = pyproj.Transformer.from_proj(inProj, outProj, always_xy=True).transform(
[-180, 180], [0, 0])
self.unitsAcrossLevel0 = abs(equator[0][1] - equator[0][0])
if not self.unitsAcrossLevel0:
raise TileSourceException(
Expand Down Expand Up @@ -443,8 +444,8 @@ def getBounds(self, srs=None):
inProj = self._proj4Proj(nativeSrs)
outProj = self._proj4Proj(srs)
keys = ('ll', 'ul', 'lr', 'ur')
pts = pyproj.itransform(inProj, outProj, [
(bounds[key]['x'], bounds[key]['y']) for key in keys], always_xy=True)
pts = pyproj.Transformer.from_proj(inProj, outProj, always_xy=True).itransform([
(bounds[key]['x'], bounds[key]['y']) for key in keys])
for idx, pt in enumerate(pts):
key = keys[idx]
bounds[key]['x'] = pt[0]
Expand Down Expand Up @@ -766,14 +767,13 @@ def _convertProjectionUnits(self, left, top, right, bottom, width, height,
else:
inProj = self._proj4Proj(units)
outProj = self._proj4Proj(self.projection)
pleft, ptop = pyproj.transform(
inProj, outProj,
transformer = pyproj.Transformer.from_proj(inProj, outProj, always_xy=True)
pleft, ptop = transformer.transform(
right if left is None else left,
bottom if top is None else top, always_xy=True)
pright, pbottom = pyproj.transform(
inProj, outProj,
bottom if top is None else top)
pright, pbottom = transformer.transform(
left if right is None else right,
top if bottom is None else bottom, always_xy=True)
top if bottom is None else bottom)
units = 'projection'
left = pleft if left is not None else None
top = ptop if top is not None else None
Expand Down Expand Up @@ -893,7 +893,7 @@ def toNativePixelCoordinates(self, x, y, proj=None, roundResults=True):
# convert to the native projection
inProj = self._proj4Proj(proj)
outProj = self._proj4Proj(self.getProj4String())
px, py = pyproj.transform(inProj, outProj, x, y, always_xy=True)
px, py = pyproj.Transformer.from_proj(inProj, outProj, always_xy=True).transform(x, y)
# convert to native pixel coordinates
with self._getDatasetLock:
gt = self.dataset.GetGeoTransform()
Expand Down
3 changes: 0 additions & 3 deletions test/test_source_bioformats.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# -*- coding: utf-8 -*-

import pytest
import sys

from large_image.cache_util import cachesClear

from . import utilities


@pytest.mark.skipif(sys.version_info < (3, 5), reason='only python >=3.5')
def testTilesFromBioformats():
import large_image_source_bioformats

Expand All @@ -28,7 +26,6 @@ def testTilesFromBioformats():
cachesClear()


@pytest.mark.skipif(sys.version_info < (3, 5), reason='only python >=3.5')
def testInternalMetadata():
import large_image_source_bioformats

Expand Down
5 changes: 5 additions & 0 deletions test/test_source_pil.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
from large_image import config
import large_image_source_pil

from large_image.cache_util import cachesClear

from . import utilities


def testTilesFromPIL():
# Ensure this test can run in any order
cachesClear()

imagePath = utilities.externaldata('data/sample_Easy1.png.sha512')
# Test with different max size options.
config.setConfig('max_small_image_size', 100)
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ setenv =
NPM_CONFIG_LOGLEVEL=warn
NPM_CONFIG_PROGRESS=false
NPM_CONFIG_PREFER_OFFLINE=true
GDAL_PAM_ENABLED=no

[testenv:flake8]
skipsdist = true
Expand Down

0 comments on commit baeeaaf

Please sign in to comment.