Skip to content

Commit ad3754a

Browse files
committed
The process cannot access the file because it is being used by another process.
1 parent c8b1386 commit ad3754a

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

azure_templates/install-msmpi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ steps:
66
Invoke-WebRequest "https://github.com/microsoft/Microsoft-MPI/releases/download/v10.1.1/msmpisetup.exe" -OutFile $pwd\msmpisetup.exe ;
77
Start-Process $pwd\msmpisetup.exe -ArgumentList '-unattend' -Wait ;
88
Remove-Item $pwd\msmpisetup.exe -Force ;
9-
Get-CimInstance -Class Win32_Product
9+
Get-CimInstance -Class Win32_Product | Where-Object Name -like "Microsoft MPI*"

azure_templates/run-test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ jobs:
66
versionSpec: ${{ parameters.PYTHON_VERSION }}
77
- template: install-msmpi.yml
88
- template: install-python-package.yml
9-
- task: CmdLine@2
10-
inputs:
11-
script: bash -c "python -m pytest --cov-config .coveragerc --cov-report term --cov=. -v tests/test_${{ parameters.GLOB }}"
9+
- script: bash -c "python -m pytest --cov-config .coveragerc --cov-report term --cov=. -v tests/test_${{ parameters.GLOB }}"
10+
displayName: 'Run test'

tests/test_monitor.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import uuid
22
import json
33
import os
4+
import sys
5+
import warnings
46

57
import pandas
68
import gym
@@ -34,7 +36,10 @@ def test_monitor():
3436
last_logline = pandas.read_csv(file_handler, index_col=None)
3537
assert set(last_logline.keys()) == {'l', 't', 'r'}, "Incorrect keys in monitor logline"
3638
file_handler.close()
37-
os.remove(mon_file)
39+
try:
40+
os.remove(mon_file)
41+
except PermissionError:
42+
warnings.warn(str(sys.exc_info()[1]))
3843

3944
def test_monitor_load_results(tmp_path):
4045
"""
@@ -82,5 +87,8 @@ def test_monitor_load_results(tmp_path):
8287

8388
assert results_size2 == (results_size1 + episode_count2)
8489

85-
os.remove(monitor_file1)
86-
os.remove(monitor_file2)
90+
try:
91+
os.remove(monitor_file1)
92+
os.remove(monitor_file2)
93+
except PermissionError:
94+
warnings.warn(str(sys.exc_info()[1]))

0 commit comments

Comments
 (0)