Skip to content

Commit a1ab518

Browse files
authored
Merge pull request #2542 from djarecka/fixget_info_2541
using RawConfigParser instead of ConfigParser (closes #2541)
2 parents 9c237fc + d0c4624 commit a1ab518

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

nipype/pkg_info.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ def pkg_commit_hash(pkg_path):
4949
pth = os.path.join(pkg_path, COMMIT_INFO_FNAME)
5050
if not os.path.isfile(pth):
5151
raise IOError('Missing commit info file %s' % pth)
52-
if PY3:
53-
cfg_parser = configparser.RawConfigParser()
54-
else:
55-
cfg_parser = configparser.ConfigParser()
52+
cfg_parser = configparser.RawConfigParser()
5653
with open(pth, encoding='utf-8') as fp:
5754
cfg_parser.readfp(fp)
5855
archive_subst = cfg_parser.get('commit hash', 'archive_subst_hash')

nipype/tests/test_nipype.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from .. import get_info
2+
from ..info import get_nipype_gitversion
3+
import pytest
24

35

46
def test_nipype_info():
@@ -10,5 +12,8 @@ def test_nipype_info():
1012
assert exception_not_raised
1113

1214

13-
# def test_fail_always():
14-
# assert False
15+
@pytest.mark.skipif(not get_nipype_gitversion(),
16+
reason="not able to get version from get_nipype_gitversion")
17+
def test_git_hash():
18+
# removing the first "g" from gitversion
19+
get_nipype_gitversion()[1:] == get_info()['commit_hash']

setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ def run(self):
7676
repo_commit = repo_commit.decode()
7777

7878
# We write the installation commit even if it's empty
79-
if PY3:
80-
cfg_parser = configparser.RawConfigParser()
81-
else:
82-
cfg_parser = configparser.ConfigParser()
79+
cfg_parser = configparser.RawConfigParser()
8380
cfg_parser.read(pjoin('nipype', 'COMMIT_INFO.txt'))
8481
cfg_parser.set('commit hash', 'install_hash', repo_commit.strip())
8582
out_pth = pjoin(self.build_lib, 'nipype', 'COMMIT_INFO.txt')

0 commit comments

Comments
 (0)