geocoders / geocoder-tester

Run search queries against a geocoder that supports geocodejson spec.
Other
40 stars 23 forks source link

Having some issues running a Germany test #3

Closed Svantulden closed 9 years ago

Svantulden commented 9 years ago

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?

yohanboniface commented 9 years ago

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

Svantulden commented 9 years ago

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?

yohanboniface commented 9 years ago

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
Svantulden commented 9 years ago

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?

yohanboniface commented 9 years ago

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 :)