2018-05-24 08:04:33 +00:00
|
|
|
"""
|
|
|
|
Test if the environment.yml is empty or it constains other data structure than a dictionary
|
|
|
|
"""
|
|
|
|
import os
|
|
|
|
import sys
|
2022-10-31 22:32:14 +00:00
|
|
|
|
2018-05-24 08:04:33 +00:00
|
|
|
import pytest
|
2022-10-31 22:32:14 +00:00
|
|
|
|
2018-05-24 08:04:33 +00:00
|
|
|
from repo2docker import buildpacks
|
|
|
|
|
2018-05-24 13:29:48 +00:00
|
|
|
|
2018-05-24 08:04:33 +00:00
|
|
|
def test_empty_env_yml(tmpdir):
|
|
|
|
tmpdir.chdir()
|
|
|
|
p = tmpdir.join("environment.yml")
|
2018-05-24 13:29:48 +00:00
|
|
|
p.write("")
|
2018-05-24 08:04:33 +00:00
|
|
|
bp = buildpacks.CondaBuildPack()
|
2018-05-24 13:29:48 +00:00
|
|
|
py_ver = bp.python_version
|
|
|
|
# If the environment.yml is empty python_version will get an empty string
|
2019-05-31 09:10:17 +00:00
|
|
|
assert py_ver == ""
|
|
|
|
|
2018-05-24 08:04:33 +00:00
|
|
|
|
|
|
|
def test_no_dict_env_yml(tmpdir):
|
|
|
|
tmpdir.chdir()
|
|
|
|
q = tmpdir.join("environment.yml")
|
2019-05-31 09:10:17 +00:00
|
|
|
q.write("numpy\n " "matplotlib\n")
|
2018-05-24 08:04:33 +00:00
|
|
|
bq = buildpacks.CondaBuildPack()
|
2018-05-24 13:29:48 +00:00
|
|
|
with pytest.raises(TypeError):
|
2019-05-31 09:10:17 +00:00
|
|
|
py_ver = bq.python_version
|