geocoders/geocoder-tester

Having some issues running a Germany test

Closed this issue · 5 comments

Hi,

I would like to use the osm-geocoding-tester to test my photon setup with some Germany data, but I am running into some issues.

First off, when running py.test -x -m germany --api-url http://localhost:2322/api/ after installing dependencies via sudo pip install -r requirements.txt, I got the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 543, in importconftest
    mod = conftestpath.pyimport()
  File "/usr/local/lib/python2.7/dist-packages/py/_path/local.py", line 641, in pyimport
    __import__(modname)
  File "/downloads/geocoder_tester/osm-geocoding-tester/conftest.py", line 6, in <module>
    from osm_geocoding_tester.base import assert_search, CONFIG
  File "/downloads/geocoder_tester/osm-geocoding-tester/osm_geocoding_tester/base.py", line 45
SyntaxError: Non-ASCII character '\xc2' in file /downloads/geocoder_tester/osm-geocoding-tester/osm_geocoding_tester/base.py on line 45, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
ERROR: could not load /downloads/geocoder_tester/osm-geocoding-tester/conftest.py

I fixed this error by adding # -*- coding: utf-8 -*- to the top of base.py (I can submit a PR if you want).

Now I run the test again and get the following error:

__________ ERROR collecting osm_geocoding_tester/world/test_basic.csv __________
conftest.py:69: in collect
    yield CSVItem(row, self)
conftest.py:128: in __init__
    super().__init__(row.get('query', ''), parent, **row)
E   TypeError: super() takes at least 1 argument (0 given)

Any idea how to fix this? I am not very experienced with Python unfortunately, so maybe this is a small issue?

Humm, I'm running it with python3.4, I guess you are on a 2.x version?

Oh yeah that makes sense. I read somewhere that python3.4 would be installed with ubuntu 14.04 (which I am using with Photon). This is the case, but when running py.test it uses 2.7.6 automatically, instead of the also-installed python3.4.

I found here that I can use the python3 command to force using 3.4, but this doesn't seem to work with py.test ? Have you got an idea how I can use the correct version for py.test?

When dealing with python, you really want to use virtualenvs.

Basically, in a brand new 14.04, you should do something like:

sudo apt-get install python-virtualenv python-pip virtualenvwrapper
mkvirtualenv photon --python=/usr/bin/python3.4

(Mayce, once virtualenvwrapper is installed, you need to start a new shell session.)
Then, from the root of osm-geocoding-tester:

pip install -r requirements.txt

To deactivate the virtualenv:

deactivate

To activate again:

workon photon

Amazing, thanks for taking the time to write this. I can now successfully run tests on my Photon machine.

Would it be beneficial for other people if I make a PR for the readme.md about this? Or should it be expected to have enough knowledge of virtualenvs before using this?

We can hardly have too much documentation, so if you feel the energy, feel free to clean this up and put in the README, yep :)