Skip to content

Commit

Permalink
Replace relative imports in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ALescoulie committed Aug 3, 2021
1 parent fb0e0b0 commit 1d3b911
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 25 deletions.
2 changes: 1 addition & 1 deletion mdpow/tests/test_Gsolv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tempdir as td
import mdpow.tests.tempdir as td

import os
import pybol
Expand Down
13 changes: 3 additions & 10 deletions mdpow/tests/test_analysis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import os.path
import sys

Expand All @@ -11,10 +9,9 @@

from numpy.testing import assert_array_almost_equal

from six.moves import cPickle as pickle
import _pickle as pickle

import numkit
import mdpow.fep

from pkg_resources import resource_filename
RESOURCES = py.path.local(resource_filename(__name__, 'testing_resources'))
Expand Down Expand Up @@ -67,12 +64,8 @@ def fep_benzene_directory(tmpdir_factory):
class TestAnalyze(object):
def get_Gsolv(self, pth):
gsolv = pth.join("FEP", "water", "Gsolv.fep")
if sys.version_info.major == 2:
G = pickle.load(gsolv.open())
elif sys.version_info.major == 3:
# Needed to read old pickle files
with open(gsolv, 'rb') as f:
G = pickle.load(f, encoding='latin1')
with open(gsolv, 'rb') as f:
G = pickle.load(f, encoding='latin1')
# patch paths
G.basedir = pth.strpath
G.filename = gsolv.strpath
Expand Down
13 changes: 3 additions & 10 deletions mdpow/tests/test_analysis_alchemlyb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import os.path
import sys

Expand All @@ -12,7 +10,7 @@
from numpy.testing import assert_array_almost_equal
import pandas

from six.moves import cPickle as pickle
import _pickle as pickle

import mdpow.fep

Expand Down Expand Up @@ -67,13 +65,8 @@ def fep_benzene_directory(tmpdir_factory):
class TestAnalyze(object):
def get_Gsolv(self, pth):
gsolv = pth.join("FEP", "water", "Gsolv.fep")
# Needed to load old pickle files in python 3
if sys.version_info.major >= 3:
with open(gsolv, 'rb') as f:
G = pickle.load(f, encoding='latin1')
# patch paths
elif sys.version_info.major == 2:
G = pickle.load(gsolv.open())
with open(gsolv, 'rb') as f:
G = pickle.load(f, encoding='latin1')
G.basedir = pth.strpath
G.filename = gsolv.strpath

Expand Down
2 changes: 1 addition & 1 deletion mdpow/tests/test_emin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tempdir as td
import mdpow.tests.tempdir as td

import mdpow.equil
import os
Expand Down
2 changes: 1 addition & 1 deletion mdpow/tests/test_equilibration_script.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tempdir as td
import mdpow.tests.tempdir as td

import os.path
import pybol
Expand Down
2 changes: 1 addition & 1 deletion mdpow/tests/test_fep_script.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tempdir as td
import mdpow.tests.tempdir as td

import os
import pybol
Expand Down
2 changes: 1 addition & 1 deletion mdpow/tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def version():
return mdpow.__version__

def test_version_string(version):
assert isinstance(version, six.string_types)
assert isinstance(version, str)

def test_version(version):
# generic non-empty check because versioneer can provide different
Expand Down

0 comments on commit 1d3b911

Please sign in to comment.