@@ -117,36 +117,35 @@ def test_environment():
117
117
pip_packages = {"xarray" : ">2024.2.0" , "pydantic" : "<=2.6.4" , }
118
118
)
119
119
120
- install_instructions = (' conda install -y cadet=4.4.0 tbb=2024.0.0' , ' pip install xarray==2024.2.0' )
120
+ install_instructions = (" conda install -y cadet=4.4.0 tbb=2024.0.0" , " pip install ' xarray==2024.2.0'" )
121
121
assert environment .prepare_install_instructions () == install_instructions
122
122
123
123
124
124
@pytest .mark .slow
125
125
def test_update_environment ():
126
126
subprocess .run (f'conda env remove -n testing_env_cadet_rdm -y' , shell = True )
127
- subprocess .run (f'conda create -n testing_env_cadet_rdm python=3.12 -y' , shell = True )
127
+ subprocess .run (f'conda create -n testing_env_cadet_rdm python=3.11 -y' , shell = True )
128
128
target_env = Environment (
129
129
conda_packages = {"libiconv" : "1.17" , "openssl" : ">=3.3" },
130
- pip_packages = {"cadet-rdm" : "0.0.44" }
130
+ # pip_packages={"cadet-rdm": "0.0.44"}
131
131
)
132
- current_env = Environment .from_yml_string (subprocess .check_output (
133
- "conda activate testing_env_cadet_rdm & conda env export" ,
134
- shell = True
135
- ).decode ())
132
+
133
+ check = subprocess .run ("conda env export -n testing_env_cadet_rdm " , shell = True , capture_output = True )
134
+ current_env = Environment .from_yml_string (check .stdout .decode ())
136
135
assert not current_env .fulfils_environment (target_env )
137
136
138
137
conda_instructions , pip_instructions = target_env .prepare_install_instructions ()
139
- conda_instructions = "conda activate testing_env_cadet_rdm && " + conda_instructions
140
- pip_instructions = "conda activate testing_env_cadet_rdm && " + pip_instructions
138
+ conda_instructions = conda_instructions .replace ("install -y" , "install --name testing_env_cadet_rdm -y" )
141
139
print (conda_instructions )
142
- print (pip_instructions )
143
140
subprocess .run (conda_instructions , shell = True )
144
- subprocess .run (pip_instructions , shell = True )
145
141
146
- current_env = Environment .from_yml_string (subprocess .check_output (
147
- f"conda activate testing_env_cadet_rdm && conda env export" ,
148
- shell = True
149
- ).decode ())
142
+ # Currently not aware of any way of activating a conda env and then running commands in it.
143
+ # pip_instructions = "conda run -n testing_env_cadet_rdm " + pip_instructions
144
+ # print(pip_instructions)
145
+ # subprocess.run(pip_instructions, shell=True)
146
+
147
+ check = subprocess .run ("conda env export -n testing_env_cadet_rdm " , shell = True , capture_output = True )
148
+ current_env = Environment .from_yml_string (check .stdout .decode ())
150
149
assert current_env .fulfils_environment (target_env )
151
150
152
151
0 commit comments