Skip to content

Commit

Permalink
Merge pull request #8 from retr0h/travis
Browse files Browse the repository at this point in the history
Added travis ci testing
  • Loading branch information
retr0h authored Apr 6, 2018
2 parents 0cdb159 + f03bbb0 commit f7af21d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
sudo: required

language: python
python:
- "2.7"
- "3.6"

install:
- pip install tox-travis

script:
- tox
24 changes: 11 additions & 13 deletions giturlparse/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,20 @@ def parse(self):
'name': None,
'owner': None,
}
regexes = [
(r'^(?P<protocol>https?|git|ssh|rsync)\://'
'(?:(?P<user>.+)@)*'
'(?P<resource>[a-z0-9_.-]*)'
'[:/]*'
'(?P<port>[\d]+){0,1}'
'(?P<pathname>\/(?P<owner>.+)/(?P<name>.+).git)'),
(r'^(?:(?P<user>.+)@)*'
'(?P<resource>[a-z0-9_.-]*)[:/]*'
'(?P<port>[\d]+){0,1}'
'[:](?P<pathname>\/?(?P<owner>.+)/(?P<name>.+).git)')
]
regexes = [(r'^(?P<protocol>https?|git|ssh|rsync)\://'
'(?:(?P<user>.+)@)*'
'(?P<resource>[a-z0-9_.-]*)'
'[:/]*'
'(?P<port>[\d]+){0,1}'
'(?P<pathname>\/(?P<owner>.+)/(?P<name>.+).git)'),
(r'^(?:(?P<user>.+)@)*'
'(?P<resource>[a-z0-9_.-]*)[:/]*'
'(?P<port>[\d]+){0,1}'
'[:](?P<pathname>\/?(?P<owner>.+)/(?P<name>.+).git)')]
for regex in regexes:
if re.search(regex, self._url):
m = re.search(regex, self._url)
d.update( m.groupdict() )
d.update(m.groupdict())
break
else:
msg = "Invalid URL '{}'".format(self._url)
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ pytest
pytest-cov
pytest-helpers-namespace
pytest-mock
yapf
yapf==0.21.0
12 changes: 9 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,30 @@ minversion = 1.8
envlist =
py{27,36}-unit
py{27,36}-lint
format-check
doc
skipsdist = true

[testenv]
passenv = *
deps =
-rrequirements.txt
-rtest-requirements.txt
commands =
unit: py.test -vv -x --cov={toxinidir}/giturlparse/ {posargs}
unit: py.test -vv
lint: flake8

[testenv:format]
commands =
yapf -i -r giturlparse/ test/
yapf -i -r giturlparse// test/

[testenv:format-check]
commands =
yapf -d -r giturlparse/ test/

[testenv:doc]
passenv = *
deps=
-rdoc-requirements.txt
commands=
python setup.py build_sphinx
python setup.py build_sphinx --builder=html

0 comments on commit f7af21d

Please sign in to comment.