Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyLothar committed Apr 7, 2015
1 parent 2ac12cb commit 13600ac
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ install:
- pip install -rtests/requirements.txt
- pip install nose

script: nosetests --with-coverage
script: python setup.py nosetests --with-coverage --cover-package=docker_registry.drivers.ufile

after_success:
- pip install coveralls
Expand Down
1 change: 1 addition & 0 deletions docker_registry/drivers/ufile.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ def _rmtree(self, dir_path):
:param dir_path: dir path to remove
"""
dir_path = remove_slash(dir_path)
# remove all file in the index
logger.info("remove dir {0}".format(dir_path))
for key in self._lsdir(dir_path):
Expand Down
16 changes: 16 additions & 0 deletions tests/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,19 @@ def test_empty_list_directory(self):

iterator = self._storage.list_directory(path)
next(iterator)

# extra testing for better coverage
def test_rm_tree(self):
self._storage.put_content("/foo/bar/baz", "d")
self._storage.put_content("/foo/quz", "d")
self._storage.remove("foo/")

tools.eq_(self._storage.exists("foo/bar/bar"), False)
tools.eq_(self._storage.exists("foo/quz"), False)

def test_exists_dir(self):
self._storage.put_content("/foo/baz", "d")
tools.eq_(self._storage.exists("foo/"), True)

self._storage.remove("foo/")
tools.eq_(self._storage.exists("foo/"), False)
25 changes: 13 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
[tox]
indexserver =
default = http://pypi.douban.com/simple

envlist = flake8, py27, py34
skipsdist = True
envlist = flake8, py27, py34
skipsdist = True

[flake8]
ignore = H102,H304,H302
exclude = .tox,.git,*.egg,build
exclude = .tox,.git,*.egg,build

[testenv]
# Install eggs
install_command = pip install --egg {opts} {packages}
sitepackages= True
deps = docker-registry-core>=2,<3
-rtests/requirements.txt
commands = python setup.py nosetests
deps = docker-registry-core>=2,<3
-rtests/requirements.txt
commands = python setup.py nosetests \
--with-coverage \
--cover-package=docker_registry.drivers.ufile \
--cover-html \
--cover-html-dir={toxinidir}/htmlcov {posargs}

[testenv:flake8]
install_command = pip install {opts} {packages}
deps = docker-registry-core>=2,<3
hacking==0.8.1
commands = flake8 {toxinidir}
deps = docker-registry-core>=2,<3
hacking==0.8.1
commands = flake8 {toxinidir}

0 comments on commit 13600ac

Please sign in to comment.