Skip to content

Commit

Permalink
The process cannot access the file because it is being used by anothe…
Browse files Browse the repository at this point in the history
…r process.
  • Loading branch information
ChengYen-Tang committed Feb 2, 2020
1 parent c8b1386 commit ad3754a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion azure_templates/install-msmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ steps:
Invoke-WebRequest "https://github.com/microsoft/Microsoft-MPI/releases/download/v10.1.1/msmpisetup.exe" -OutFile $pwd\msmpisetup.exe ;
Start-Process $pwd\msmpisetup.exe -ArgumentList '-unattend' -Wait ;
Remove-Item $pwd\msmpisetup.exe -Force ;
Get-CimInstance -Class Win32_Product
Get-CimInstance -Class Win32_Product | Where-Object Name -like "Microsoft MPI*"
5 changes: 2 additions & 3 deletions azure_templates/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ jobs:
versionSpec: ${{ parameters.PYTHON_VERSION }}
- template: install-msmpi.yml
- template: install-python-package.yml
- task: CmdLine@2
inputs:
script: bash -c "python -m pytest --cov-config .coveragerc --cov-report term --cov=. -v tests/test_${{ parameters.GLOB }}"
- script: bash -c "python -m pytest --cov-config .coveragerc --cov-report term --cov=. -v tests/test_${{ parameters.GLOB }}"
displayName: 'Run test'
14 changes: 11 additions & 3 deletions tests/test_monitor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import uuid
import json
import os
import sys
import warnings

import pandas
import gym
Expand Down Expand Up @@ -34,7 +36,10 @@ def test_monitor():
last_logline = pandas.read_csv(file_handler, index_col=None)
assert set(last_logline.keys()) == {'l', 't', 'r'}, "Incorrect keys in monitor logline"
file_handler.close()
os.remove(mon_file)
try:
os.remove(mon_file)
except PermissionError:
warnings.warn(str(sys.exc_info()[1]))

def test_monitor_load_results(tmp_path):
"""
Expand Down Expand Up @@ -82,5 +87,8 @@ def test_monitor_load_results(tmp_path):

assert results_size2 == (results_size1 + episode_count2)

os.remove(monitor_file1)
os.remove(monitor_file2)
try:
os.remove(monitor_file1)
os.remove(monitor_file2)
except PermissionError:
warnings.warn(str(sys.exc_info()[1]))

0 comments on commit ad3754a

Please sign in to comment.