-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
110 additions
and
18 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,51 @@ | ||
import sys | ||
from nose.tools import * | ||
from mock import patch | ||
|
||
# inside distributed version, there is no setup_extra files already | ||
sys.path.insert(0,'../..') | ||
try: | ||
setup_extra = __import__('setup_extra') | ||
except ImportError: | ||
setup_extra = None | ||
|
||
|
||
def _get_values(): | ||
return None, 'library' | ||
|
||
|
||
def _get_dpkg_output(): | ||
r = """libgvc: /usr/local/include/graphviz/gvc.h | ||
gphviz: /usr/local/lib/graphviz/graphviz.so""" | ||
if sys.version_info >= (3, 0): | ||
s = bytes(r, encoding='utf8') | ||
else: | ||
s = str(r) | ||
return s | ||
|
||
|
||
def test_try(): | ||
if setup_extra: | ||
i, l = None, None | ||
i, l = setup_extra._try_configure(i, l, _get_values) | ||
assert_equals(i, None) | ||
assert_equals(l, 'library') | ||
|
||
|
||
@patch('subprocess.check_output') | ||
def test_dpkg_config(subprocess_mock): | ||
if setup_extra: | ||
subprocess_mock.return_value = _get_dpkg_output() | ||
i, l = setup_extra._dpkg_config() | ||
assert_equal(i, '/usr/local/include/graphviz') | ||
assert_equal(l, '/usr/local/lib/graphviz') | ||
|
||
|
||
def test_b2str(): | ||
if setup_extra: | ||
if sys.version_info >= (3, 0): | ||
r = bytes('abc', encoding='utf8') | ||
else: | ||
r = str('abc') | ||
s = setup_extra._b2str(r) | ||
assert_equal(s, u'abc') |
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