Fix some tests

This commit is contained in:
Bastian Kleineidam 2014-03-02 07:45:04 +01:00
parent 98c8163179
commit 924c6285d2
4 changed files with 14 additions and 10 deletions

View file

@ -53,7 +53,11 @@ def start_server (host, port):
if "kill" in msg:
raise KeyboardInterrupt()
from pyftpdlib import ftpserver
try:
from pyftpdlib import ftpserver
except ImportError:
pytest.skip("pyftpdlib is not available")
return
authorizer = ftpserver.DummyAuthorizer()
datadir = os.path.join(os.path.dirname(__file__), 'data')
authorizer.add_anonymous(datadir)

View file

@ -1,5 +1,5 @@
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2010 Bastian Kleineidam
# Copyright (C) 2004-2010,2014 Bastian Kleineidam
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -24,13 +24,13 @@ from . import LinkCheckTest
# to enable the has_newsserver() resource manually.
NNTP_SERVER = "news.uni-stuttgart.de"
# info string returned by news server
NNTP_INFO = u"201 news.uni-stuttgart.de InterNetNews NNRP server " \
u"INN 2.4.4 (20060818 snapshot) ready (no posting)."
NNTP_INFO = u"200 news.uni-stuttgart.de InterNetNews NNRP server " \
u"INN 2.5.2 ready (no posting)"
# Most free NNTP servers are slow, so don't waist a lot of time running those.
NNTP_TIMEOUT_SECS = 30
# disabled for now until some stable news server comes up
class _TestNews (LinkCheckTest):
class TestNews (LinkCheckTest):
"""Test nntp: and news: link checking."""
def newstest (self, url, resultlines):

View file

@ -37,8 +37,8 @@ class TestFilenames (unittest.TestCase):
path = 'c:\\'
realpath = get_nt_filename(path)
self.assertEqual(path, realpath)
# Only works on my computer.
# XXX Only works on my computer.
# Is there a Windows UNC share that is always available for tests?
path = '\\Vboxsrv\share\msg.txt'
realpath = get_nt_filename(path)
self.assertEqual(path, realpath)
#path = '\\Vboxsrv\share\msg.txt'
#realpath = get_nt_filename(path)
#self.assertEqual(path, realpath)

View file

@ -60,7 +60,7 @@ class TestStrFormat (unittest.TestCase):
self.assertEqual(wrap(s, -1), s)
self.assertEqual(wrap(s, 0), s)
l = len(os.linesep)
gap = " "*l
gap = " "
s2 = "11%(gap)s22%(sep)s33%(gap)s44%(sep)s55" % \
{'sep': os.linesep, 'gap': gap}
# splitting lines