-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from scrapinghub/fix-version-name
[MRG+1] Fix version names when setup.py --version returns many lines
- Loading branch information
Showing
2 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python | ||
# coding=utf-8 | ||
|
||
|
||
import unittest | ||
from mock import patch | ||
from shub import utils | ||
from click.testing import CliRunner | ||
|
||
|
||
class UtilsTest(unittest.TestCase): | ||
def setUp(self): | ||
self.runner = CliRunner() | ||
|
||
def test_dependency_version_from_setup_is_parsed_properly(self): | ||
def check(cmd): | ||
if cmd == 'python setup.py --version': | ||
return setup_version | ||
|
||
setup_version = ('Building lxml version 3.4.4.' | ||
'\nBuilding without Cython.' | ||
'\nUsing build configuration of libxslt 1.1.28' | ||
'\n3.4.4') | ||
|
||
with self.runner.isolated_filesystem(): | ||
with patch('shub.utils.run', side_effect=check) as mocked_run: | ||
# given | ||
mocked_run.return_value = setup_version | ||
# when | ||
version = utils._get_dependency_version('lxml') | ||
# then | ||
self.assertEquals('lxml-3.4.4', version) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |