diff --git a/.ci/travis/install.sh b/.ci/travis/install.sh index 811ebd1e..fceab7a7 100755 --- a/.ci/travis/install.sh +++ b/.ci/travis/install.sh @@ -14,24 +14,24 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then case "${PYVER}" in py26) - pyenv install 2.6.9 - pyenv virtualenv 2.6.9 pyftpdlib + pyenv install 2.6 + pyenv virtualenv 2.6 psutil ;; py27) - pyenv install 2.7.10 - pyenv virtualenv 2.7.10 pyftpdlib - ;; - py32) - pyenv install 3.2.6 - pyenv virtualenv 3.2.6 pyftpdlib + pyenv install 2.7 + pyenv virtualenv 2.7 psutil ;; py33) - pyenv install 3.3.6 - pyenv virtualenv 3.3.6 pyftpdlib + pyenv install 3.3 + pyenv virtualenv 3.3 psutil ;; py34) - pyenv install 3.4.3 - pyenv virtualenv 3.4.3 pyftpdlib + pyenv install 3.4 + pyenv virtualenv 3.4 psutil + ;; + py35) + pyenv install 3.5 + pyenv virtualenv 3.5 psutil ;; esac pyenv rehash @@ -42,4 +42,4 @@ if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]] || [[ $PYVER == 'py26' ]]; then pip install -U unittest2 fi -pip install -U pyopenssl pysendfile flake8 mock +pip install -U pyopenssl pysendfile flake8 mock coveralls diff --git a/.coveragerc b/.coveragerc index c8faf288..abce8c07 100644 --- a/.coveragerc +++ b/.coveragerc @@ -17,5 +17,6 @@ exclude_lines = if hasattr(select, 'epoll'): if hasattr(select, 'kqueue'): if PY3: - if hasattr(select, 'devpoll') - if hasattr(select, 'kqueue') + if hasattr(select, 'devpoll'): + if hasattr(select, 'kqueue'): + if os.sep == "\\": diff --git a/.travis.yml b/.travis.yml index d28ce002..8d5a50ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,27 +4,28 @@ matrix: include: - python: 2.6 - python: 2.7 - - python: 3.2 - python: 3.3 - python: 3.4 + - python: 3.5 - language: generic os: osx env: PYVER=py26 - language: generic os: osx env: PYVER=py27 - - language: generic - os: osx - env: PYVER=py32 - language: generic os: osx env: PYVER=py33 - language: generic os: osx env: PYVER=py34 + # XXX - not supported yet + # - language: generic + # os: osx + # env: PYVER=py35 install: - ./.ci/travis/install.sh script: - ./.ci/travis/run.sh -# after_success: -# - coveralls # upload reports to coveralls.io +after_success: + - coveralls # upload reports to coveralls.io diff --git a/README.rst b/README.rst index dda8696c..6ae27642 100644 --- a/README.rst +++ b/README.rst @@ -14,6 +14,10 @@ :target: https://travis-ci.org/giampaolo/pyftpdlib :alt: Travis +.. image:: https://coveralls.io/repos/giampaolo/pyftpdlib/badge.svg?branch=master&service=github + :target: https://coveralls.io/github/giampaolo/pyftpdlib?branch=master + :alt: Test coverage (coverall.io) + Quick links =========== diff --git a/appveyor.yml b/appveyor.yml index 1d383a33..fc51e050 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -52,7 +52,8 @@ install: # - ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py') # - "%PYTHON%/python.exe C:/get-pip.py" # - "%PYTHON%/python.exe -m pip install ..." - - "%WITH_COMPILER% %PYTHON%/Scripts/pip.exe install pip install -U pyopenssl ipaddress unittest2 --upgrade" + - "%WITH_COMPILER% %PYTHON%/Scripts/pip.exe install pip --upgrade" + - "%WITH_COMPILER% %PYTHON%/Scripts/pip.exe install unittest2 ipaddress pypiwin32 wmi wheel setuptools pyopenssl --upgrade" # 1.0.1 is the latest release supporting python 2.6 - "%WITH_COMPILER% %PYTHON%/Scripts/pip.exe install mock==1.0.1" - "%WITH_COMPILER% %PYTHON%/python.exe setup.py install" diff --git a/pyftpdlib/ioloop.py b/pyftpdlib/ioloop.py index 1f45ffb2..ec25cbe0 100644 --- a/pyftpdlib/ioloop.py +++ b/pyftpdlib/ioloop.py @@ -569,7 +569,7 @@ def poll(self, timeout): # --- /dev/poll - Solaris (introduced in python 3.3) # =================================================================== -if hasattr(select, 'devpoll'): +if hasattr(select, 'devpoll'): # pragma: no cover class DevPoll(_BasePollEpoll): """/dev/poll based poller (introduced in python 3.3).""" @@ -630,7 +630,7 @@ def close(self): # --- kqueue() - BSD / OSX # =================================================================== -if hasattr(select, 'kqueue'): +if hasattr(select, 'kqueue'): # pragma: no cover class Kqueue(_IOLoop): """kqueue() based poller.""" diff --git a/pyftpdlib/test/test_functional.py b/pyftpdlib/test/test_functional.py index 99584e6a..bd6a58f7 100644 --- a/pyftpdlib/test/test_functional.py +++ b/pyftpdlib/test/test_functional.py @@ -2406,7 +2406,7 @@ def test_port_race_condition(self): bytes = hbytes + pbytes cmd = 'PORT ' + ','.join(bytes) + '\r\n' self.client.sock.sendall(b(cmd)) - self.client.quit() + self.client.getresp() s, addr = sock.accept() s.close() diff --git a/pyftpdlib/test/test_ioloop.py b/pyftpdlib/test/test_ioloop.py index d39ad1a6..b9fdebeb 100644 --- a/pyftpdlib/test/test_ioloop.py +++ b/pyftpdlib/test/test_ioloop.py @@ -186,8 +186,7 @@ class PollIOLoopTestCase(unittest.TestCase, BaseIOLoopTestCase): def test_eintr_on_poll(self): # EINTR is supposed to be ignored - with mock.patch(self.poller_mock, - return_vaue=mock.Mock()) as m: + with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m: if not PY3: m.return_value.poll.side_effect = select.error m.return_value.poll.side_effect.errno = errno.EINTR @@ -197,8 +196,7 @@ def test_eintr_on_poll(self): s.poll(0) assert m.called # ...but just that - with mock.patch(self.poller_mock, - return_vaue=mock.Mock()) as m: + with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m: if not PY3: m.return_value.poll.side_effect = select.error m.return_value.poll.side_effect.errno = errno.EBADF @@ -210,14 +208,12 @@ def test_eintr_on_poll(self): def test_eexist_on_register(self): # EEXIST is supposed to be ignored - with mock.patch(self.poller_mock, - return_vaue=mock.Mock()) as m: + with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m: m.return_value.register.side_effect = \ EnvironmentError(errno.EEXIST, "") s, rd, wr = self.test_register() # ...but just that - with mock.patch(self.poller_mock, - return_vaue=mock.Mock()) as m: + with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m: m.return_value.register.side_effect = \ EnvironmentError(errno.EBADF, "") self.assertRaises(EnvironmentError, self.test_register) @@ -225,15 +221,13 @@ def test_eexist_on_register(self): def test_enoent_ebadf_on_unregister(self): # ENOENT and EBADF are supposed to be ignored for errnum in (errno.EBADF, errno.ENOENT): - with mock.patch(self.poller_mock, - return_vaue=mock.Mock()) as m: + with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m: m.return_value.unregister.side_effect = \ EnvironmentError(errnum, "") s, rd, wr = self.test_register() s.unregister(rd) # ...but just those - with mock.patch(self.poller_mock, - return_vaue=mock.Mock()) as m: + with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m: m.return_value.unregister.side_effect = \ EnvironmentError(errno.EEXIST, "") s, rd, wr = self.test_register() @@ -241,8 +235,7 @@ def test_enoent_ebadf_on_unregister(self): def test_enoent_on_modify(self): # ENOENT is supposed to be ignored - with mock.patch(self.poller_mock, - return_vaue=mock.Mock()) as m: + with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m: m.return_value.modify.side_effect = \ OSError(errno.ENOENT, "") s, rd, wr = self.test_register()