#203 Add tox and fix a few issues
Merged by cqi. Opened by cqi.
cqi/fedpkg add-tox  into  master

Download 203.patch

This PR adds tox to run tests to ensure code works with several Python 2 and 3 versions.

A few code style errors and an error in a test are also fixed. When run tests by tox, this test fails due to an invalid URL schema, the error is

======================================================================
ERROR: Test verify_sls with an SL that is not June 1st or December 1st. An
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/cqi/code/fedpkg/test/test_utils.py", line 112, in test_verify_sls_invalid_date
    utils.verify_sls('abc', sls)
  File "/home/cqi/code/fedpkg/fedpkg/utils.py", line 197, in verify_sls
    sl_obj = get_sl_type(pdc_url, sl)
  File "/home/cqi/code/fedpkg/fedpkg/utils.py", line 34, in get_sl_type
    rv = requests.get(api_url_w_args, timeout=60)
  File "/home/cqi/code/fedpkg/.tox/py27/lib/python2.7/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/home/cqi/code/fedpkg/.tox/py27/lib/python2.7/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/cqi/code/fedpkg/.tox/py27/lib/python2.7/site-packages/requests/sessions.py", line 494, in request
    prep = self.prepare_request(req)
  File "/home/cqi/code/fedpkg/.tox/py27/lib/python2.7/site-packages/requests/sessions.py", line 437, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/home/cqi/code/fedpkg/.tox/py27/lib/python2.7/site-packages/requests/models.py", line 305, in prepare
    self.prepare_url(url, params)
  File "/home/cqi/code/fedpkg/.tox/py27/lib/python2.7/site-packages/requests/models.py", line 379, in prepare_url
    raise MissingSchema(error)
MissingSchema: Invalid URL 'abc/rest_api/v1/component-sla-types/?name=bug_fixes': No schema supplied. Perhaps you meant http://abc/rest_api/v1/component-sla-types/?name=bug_fixes?

To fix this, just replace abc to a fake PDC URL to make it work again.

Commit f3319814 fixes this pull-request

Pull-Request has been merged by cqi

Pull-Request has been merged by cqi

Metadata