Skip to content

Commit

Permalink
Fixing tests to sort the output before comparing
Browse files Browse the repository at this point in the history
  • Loading branch information
carlio committed Sep 27, 2014
1 parent 9c16415 commit 537139e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion requirements_detector/detect.py
Expand Up @@ -85,7 +85,9 @@ def find_requirements(path):
setup_py = os.path.join(path, 'setup.py')
if os.path.exists(setup_py) and os.path.isfile(setup_py):
try:
return from_setup_py(setup_py)
requirements = from_setup_py(setup_py)
requirements.sort()
return requirements
except CouldNotParseRequirements:
pass

Expand Down
10 changes: 5 additions & 5 deletions tests/test_detection.py
Expand Up @@ -21,7 +21,7 @@ def test_requirements_txt_parsing(self):
'South==0.8.2',
)

self.assertEqual(expected, dependencies)
self.assertEqual(expected, sorted(dependencies))

def test_requirements_dir_parsing(self):
filepath = os.path.join(os.path.dirname(__file__), 'detection/test2/requirements')
Expand All @@ -34,7 +34,7 @@ def test_requirements_dir_parsing(self):
'South==0.8.2',
)

self.assertEqual(expected, dependencies)
self.assertEqual(expected, sorted(dependencies))

def test_requirements_blob_parsing(self):
filepath = os.path.join(os.path.dirname(__file__), 'detection/test3')
Expand All @@ -46,19 +46,19 @@ def test_requirements_blob_parsing(self):
'django-gubbins==1.1.2',
)

self.assertEqual(expected, dependencies)
self.assertEqual(expected, sorted(dependencies))

def test_invalid_requirements_txt(self):
filepath = os.path.join(os.path.dirname(__file__), 'detection/test5/invalid_requirements.txt')
dependencies = from_requirements_txt(filepath)
expected = self._expected('django<1.6', 'django')
self.assertEqual(expected, dependencies)
self.assertEqual(expected, sorted(dependencies))

def _test_setup_py(self, setup_py_file, *expected):
filepath = os.path.join(os.path.dirname(__file__), 'detection/test4', setup_py_file)
dependencies = from_setup_py(filepath)
expected = self._expected(*expected)
self.assertEqual(expected, dependencies)
self.assertEqual(expected, sorted(dependencies))

def _test_setup_py_not_parseable(self, setup_py_file):
filepath = os.path.join(os.path.dirname(__file__), 'detection/test4', setup_py_file)
Expand Down

0 comments on commit 537139e

Please sign in to comment.