@@ -42,9 +42,19 @@ def create_virtualenv():
4242 # Create virtual environment
4343 "python3 -m venv test_env" ,
4444 ]
45- os .environ ["PATH" ] = (
46- "/test_env/bin/" + os .pathsep + os .environ .get ("PATH" , "" )
45+ os .environ ["PATH" ] = os .pathsep .join (
46+ (
47+ os .path .join (os .getcwd (), "test_env" , "bin" ),
48+ os .environ .get ("PATH" , "" ),
49+ )
4750 )
51+ if os .name == "nt" :
52+ os .environ ["PATH" ] = os .pathsep .join (
53+ (
54+ os .path .join (os .getcwd (), "test_env" , "Scripts" ),
55+ os .environ ["PATH" ],
56+ )
57+ )
4858 run_commands_local (env_setup )
4959
5060
@@ -53,18 +63,17 @@ def manage_venv_installs(whl_path):
5363 backend_pkg , backend_extra_url = BACKEND_REQ [backend .backend ()]
5464 install_setup = [
5565 # Installs the backend's package and common requirements
56- "pip install " + backend_extra_url + backend_pkg ,
66+ f "pip install { backend_extra_url } { backend_pkg } " ,
5767 "pip install -r requirements-common.txt" ,
5868 "pip install pytest" ,
5969 # Ensure other backends are uninstalled
60- "pip uninstall -y "
61- + BACKEND_REQ [other_backends [0 ]][0 ]
62- + " "
63- + BACKEND_REQ [other_backends [1 ]][0 ]
64- + " "
65- + BACKEND_REQ [other_backends [2 ]][0 ],
70+ "pip uninstall -y {0} {1} {2}" .format (
71+ BACKEND_REQ [other_backends [0 ]][0 ],
72+ BACKEND_REQ [other_backends [1 ]][0 ],
73+ BACKEND_REQ [other_backends [2 ]][0 ],
74+ ),
6675 # Install `.whl` package
67- "pip install " + whl_path ,
76+ f "pip install { whl_path } " ,
6877 ]
6978 # Install flax for JAX when NNX is enabled
7079 if backend .backend () == "jax" and config .is_nnx_enabled ():
@@ -102,7 +111,11 @@ def run_commands_venv(commands):
102111 for command in commands :
103112 print (f"Running command: { command } " )
104113 cmd_with_args = command .split (" " )
105- cmd_with_args [0 ] = "test_env/bin/" + cmd_with_args [0 ]
114+ cmd_with_args [0 ] = os .path .join (
115+ "test_env" ,
116+ "Scripts" if os .name == "nt" else "bin" ,
117+ cmd_with_args [0 ],
118+ )
106119 p = subprocess .Popen (cmd_with_args )
107120 assert p .wait () == 0
108121
0 commit comments