summaryrefslogtreecommitdiff
path: root/tests/test_scripts/test_pdistreport.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_scripts/test_pdistreport.py')
-rw-r--r--tests/test_scripts/test_pdistreport.py63
1 files changed, 37 insertions, 26 deletions
diff --git a/tests/test_scripts/test_pdistreport.py b/tests/test_scripts/test_pdistreport.py
index e229667c5..031a6ff2b 100644
--- a/tests/test_scripts/test_pdistreport.py
+++ b/tests/test_scripts/test_pdistreport.py
@@ -1,57 +1,68 @@
import unittest
+
class TestPDistReportCommand(unittest.TestCase):
def _callFUT(self, **kw):
argv = []
from pyramid.scripts.pdistreport import main
+
return main(argv, **kw)
def test_no_dists(self):
def platform():
return 'myplatform'
+
pkg_resources = DummyPkgResources()
L = []
+
def out(*args):
L.extend(args)
- result = self._callFUT(pkg_resources=pkg_resources, platform=platform,
- out=out)
+
+ result = self._callFUT(
+ pkg_resources=pkg_resources, platform=platform, out=out
+ )
self.assertEqual(result, None)
self.assertEqual(
L,
- ['Pyramid version:', '1',
- 'Platform:', 'myplatform',
- 'Packages:']
- )
+ ['Pyramid version:', '1', 'Platform:', 'myplatform', 'Packages:'],
+ )
def test_with_dists(self):
def platform():
return 'myplatform'
+
working_set = (DummyDistribution('abc'), DummyDistribution('def'))
pkg_resources = DummyPkgResources(working_set)
L = []
+
def out(*args):
L.extend(args)
- result = self._callFUT(pkg_resources=pkg_resources, platform=platform,
- out=out)
+
+ result = self._callFUT(
+ pkg_resources=pkg_resources, platform=platform, out=out
+ )
self.assertEqual(result, None)
self.assertEqual(
L,
- ['Pyramid version:',
- '1',
- 'Platform:',
- 'myplatform',
- 'Packages:',
- ' ',
- 'abc',
- '1',
- ' ',
- '/projects/abc',
- ' ',
- 'def',
- '1',
- ' ',
- '/projects/def']
- )
+ [
+ 'Pyramid version:',
+ '1',
+ 'Platform:',
+ 'myplatform',
+ 'Packages:',
+ ' ',
+ 'abc',
+ '1',
+ ' ',
+ '/projects/abc',
+ ' ',
+ 'def',
+ '1',
+ ' ',
+ '/projects/def',
+ ],
+ )
+
class DummyPkgResources(object):
def __init__(self, working_set=()):
@@ -60,14 +71,14 @@ class DummyPkgResources(object):
def get_distribution(self, name):
return Version('1')
+
class Version(object):
def __init__(self, version):
self.version = version
+
class DummyDistribution(object):
def __init__(self, name):
self.project_name = name
self.version = '1'
self.location = '/projects/%s' % name
-
-