from packaging.errors import PackagingFileError, PackagingOptionError
from packaging.tests import unittest, support
-from packaging.tests.pypi_server import PyPIServerTestCase
+try:
+ import threading
+ from packaging.tests.pypi_server import PyPIServerTestCase
+except ImportError:
+ threading = None
+ PyPIServerTestCase = object
EXPECTED_MULTIPART_OUTPUT = [
password = long_island
"""
+
+@unittest.skipIf(threading is None, "Needs threading")
class UploadDocsTestCase(support.TempdirManager,
support.EnvironRestorer,
support.LoggingCatcher,
from packaging.metadata import Metadata
from packaging.tests.support import LoggingCatcher, TempdirManager, unittest
-from packaging.tests.pypi_server import use_xmlrpc_server
+try:
+ import threading
+ from packaging.tests.pypi_server import use_xmlrpc_server
+except ImportError:
+ threading = None
+ use_xmlrpc_server = None
class InstalledDist:
conflict = [(o.name, str(o.version)) for o in output['conflict']]
return installed, remove, conflict
+ @unittest.skipIf(threading is None, 'needs threading')
@use_xmlrpc_server()
def test_existing_deps(self, server):
# Test that the installer get the dependencies from the metadatas
self.assertIn(('towel-stuff', '0.1'), readable_output)
self.assertIn(('choxie', '2.0.0.9'), readable_output)
+ @unittest.skipIf(threading is None, 'needs threading')
@use_xmlrpc_server()
def test_upgrade_existing_deps(self, server):
client = self._get_client(server)
self.assertIn(('bacon', '0.1'), remove)
self.assertEqual(0, len(output['conflict']))
+ @unittest.skipIf(threading is None, 'needs threading')
@use_xmlrpc_server()
def test_conflicts(self, server):
# Tests that conflicts are detected
self.assertIn(('bacon', '0.1'), remove)
self.assertIn(('chicken', '1.1'), conflict)
+ @unittest.skipIf(threading is None, 'needs threading')
@use_xmlrpc_server()
def test_installation_unexisting_project(self, server):
# Test that the isntalled raises an exception if the project does not
import urllib.parse
import urllib.error
-from packaging.tests.pypi_server import PyPIServer, PYPI_DEFAULT_STATIC_PATH
+try:
+ import threading
+ from packaging.tests.pypi_server import PyPIServer, PYPI_DEFAULT_STATIC_PATH
+except ImportError:
+ threading = None
+ PyPIServer = None
+ PYPI_DEFAULT_STATIC_PATH = None
+
from packaging.tests import unittest
+@unittest.skipIf(threading is None, "Needs threading")
class PyPIServerTest(unittest.TestCase):
def test_records_requests(self):
from packaging.pypi.xmlrpc import Client, InvalidSearchField, ProjectNotFound
from packaging.tests import unittest
-from packaging.tests.pypi_server import use_xmlrpc_server
+try:
+ import threading
+ from packaging.tests.pypi_server import use_xmlrpc_server
+except ImportError:
+ threading = None
+ use_xmlrpc_server = None
+
+@unittest.skipIf(threading is None, "Needs threading")
class TestXMLRPCClient(unittest.TestCase):
def _get_client(self, server, *args, **kwargs):
return Client(server.full_address, *args, **kwargs)