Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed May 23, 2017
1 parent 2b23507 commit 1dca270
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions _unittests/ut_install/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def test_install(self):

m = ModuleInstall("jsdifflib", "github", gitrepo="cemerick", fLOG=fLOG)
files = m.download(temp_folder=temp, unzipFile=True, source="2")
assert len(files) > 0
self.assertTrue(len(files) > 0)
for _ in files:
assert os.path.exists(_)
self.assertTrue(os.path.exists(_))

def test_install_mlpy(self):
fLOG(
Expand All @@ -87,7 +87,7 @@ def test_install_mlpy(self):
if sys.platform.startswith("win"):
m = ModuleInstall("mlpy", "wheel", fLOG=fLOG)
whl = m.download(temp_folder=temp, source="2")
assert os.path.exists(whl)
self.assertTrue(os.path.exists(whl))

def test_install_scikit(self):
fLOG(
Expand All @@ -109,7 +109,7 @@ def test_install_scikit(self):
mname="sklearn",
fLOG=fLOG)
whl = m.download(temp_folder=temp, source="2")
assert os.path.exists(whl)
self.assertTrue(os.path.exists(whl))
if os.stat(whl).st_size < 1000:
raise Exception("small file: " + whl)

Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_download_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_install_numpy(self):
"wheel",
fLOG=fLOG,
source=source)
name = m.get_exewheel_url_link(wheel=True)
name = m.get_exewheel_url_link(wheel=True, source=source)
fLOG(m.existing_version)
r = compare_version(m.existing_version, "1.10.1")
self.assertTrue(r >= 0)
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_download_psycopg2.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_install_tables(self):
m = find_module_install("psycopg2")
m.fLOG = fLOG
whl = m.download(temp_folder=temp, source="2")
assert os.path.exists(whl)
self.assertTrue(os.path.exists(whl))


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_download_pycuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_install_pycuda(self):
file_save=os.path.join(
temp,
"out_page.html"), source="2")
assert os.path.exists(exe)
self.assertTrue(os.path.exists(exe))


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_download_pywin32.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_install_pywin32(self):
fLOG(m.__module__)
m.fLOG = fLOG
whl = m.download(temp_folder=temp, source="2")
assert os.path.exists(whl)
self.assertTrue(os.path.exists(whl))


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_download_seqlearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_install_seqlearn(self):
source = "2" if is_travis_or_appveyor() else None
m = find_module_install("seqlearn")
m.source = source
name = m.get_exewheel_url_link(wheel=True)
name = m.get_exewheel_url_link(wheel=True, source=source)
fLOG(m.existing_version)
r = compare_version(m.existing_version, "0.2")
self.assertTrue(r >= 0)
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_download_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_install_ipython(self):
if sys.platform.startswith("win"):
m = ModuleInstall("SQLAlchemy", "wheel", fLOG=fLOG)
whl = m.download(temp_folder=temp, source="2")
assert os.path.exists(whl)
self.assertTrue(os.path.exists(whl))


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_download_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_install_tables(self):
if sys.platform.startswith("win"):
m = ModuleInstall("tables", "wheel", fLOG=fLOG)
whl = m.download(temp_folder=temp, source="2")
assert os.path.exists(whl)
self.assertTrue(os.path.exists(whl))


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions _unittests/ut_install/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def test_install(self):
# disabled on python 2.7 and anaconda
return
m = ModuleInstall("pip", "pip")
assert m.install()
self.assertTrue(m.install())
m = ModuleInstall("pip", "exe")
assert m.install()
self.assertTrue(m.install())


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_install_build_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_build_install(self):
create_virtual_env(temp, fLOG=fLOG)
setup = os.path.normpath(os.path.join(
temp, "..", "..", "..", "setup.py"))
assert os.path.exists(setup)
self.assertTrue(os.path.exists(setup))
folder = os.path.split(setup)[0]
cmd = "{0} install".format(setup)
fLOG("CMD: " + cmd)
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_install_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_compare_version(self):
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
assert compare_version("0.16.0", "0.16.2") == -1
self.assertEqual(compare_version("0.16.0", "0.16.2"), -1)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions _unittests/ut_install/test_install_module_is_installed.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def test_module_version(self):
OutputPrint=__name__ == "__main__")

mod = ModuleInstall("pep8", "pip", fLOG=fLOG)
assert mod.is_installed_local()
assert mod.is_installed_local_cmd()
self.assertTrue(mod.is_installed_local())
self.assertTrue(mod.is_installed_local_cmd())


if __name__ == "__main__":
Expand Down
8 changes: 4 additions & 4 deletions _unittests/ut_install/test_install_module_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def test_module_version(self):

res = get_module_version("matplotlib")
fLOG(res)
assert len(res) > 0
self.assertTrue(len(res) > 0)

res = get_module_metadata("matplotlib")
fLOG(res)
assert isinstance(res, dict)
self.assertTrue(isinstance(res, dict))

def test_all_module_summary(self):

Expand All @@ -81,11 +81,11 @@ def test_all_module_summary(self):
nolic = df[df.license.isnull()]
fLOG("no license", nolic.shape)
fLOG(nolic[["name", "license"]])
assert lic.shape[0] > 0
self.assertTrue(lic.shape[0] > 0)

rst = df2rst(df)
# fLOG(rst)
assert len(rst) > 1000
self.assertTrue(len(rst) > 1000)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions _unittests/ut_install/test_is_installed.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def test_is_installed(self):
if is_travis_or_appveyor() or sys.version_info[0] == 2:
return
mod = find_module_install("imbalanced-learn")
assert mod.is_installed_local()
self.assertTrue(mod.is_installed_local())
r = is_package_installed(sys.real_prefix if hasattr(
sys, "real_prefix") else sys.prefix, "imbalanced-learn")
assert r
self.assertTrue(r)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_missing_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_missing_module(self):
OutputPrint=__name__ == "__main__")

deps = missing_dependencies()
assert isinstance(deps, dict)
self.assertTrue(isinstance(deps, dict))
for k, v in sorted(deps.items()):
fLOG(k, "--->", ", ".join(v))

Expand Down
4 changes: 2 additions & 2 deletions _unittests/ut_install/test_module_dependencies_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TestModuleDependenciesBug(unittest.TestCase):
def common_function(self, name, use_pip=None):
res = get_module_dependencies(name, deep=True, use_pip=use_pip)
for k, v in sorted(res.items()):
assert isinstance(v, tuple)
self.assertTrue(isinstance(v, tuple))
fLOG(k, "-->", v)
if len(res) < 3:
from pip import get_installed_distributions
Expand All @@ -68,7 +68,7 @@ def test_dependencies_luigi(self):
try:
import luigi
mod = "luigi"
assert luigi is not None
self.assertTrue(luigi is not None)
except ImportError:
mod = "pandas"

Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_install/test_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_links(self):
for l in links:
if "heatmap" in l[0]:
fLOG(l)
assert len(links) > 0
self.assertTrue(len(links) > 0)

if not sys.platform.startswith("win"):
return
Expand Down

0 comments on commit 1dca270

Please sign in to comment.