Virtual-environments: Workflow using docker-compose running pytest results I/O operation on closed file

Created on 30 Apr 2020  路  5Comments  路  Source: actions/virtual-environments

In this Community Forum ticket, the user is trying to setup a workflow for his project, which uses docker-compose to run tests with pytest. However executing pytest results the following error in the workflow run.

[3384] Failed to execute script docker-compose
Traceback (most recent call last):
  File "site-packages/dockerpty/pty.py", line 334, in start
  File "site-packages/dockerpty/pty.py", line 367, in _hijack_tty
  File "site-packages/dockerpty/io.py", line 59, in select
  File "site-packages/dockerpty/io.py", line 351, in fileno
  File "site-packages/dockerpty/io.py", line 103, in fileno
  File "socket.py", line 638, in fileno
ValueError: I/O operation on closed file.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 72, in main
  File "compose/cli/main.py", line 128, in perform_command
  File "compose/cli/main.py", line 519, in exec_command
  File "site-packages/dockerpty/pty.py", line 338, in start
  File "site-packages/dockerpty/io.py", line 32, in set_blocking
  File "site-packages/dockerpty/io.py", line 351, in fileno
  File "site-packages/dockerpty/io.py", line 103, in fileno
  File "socket.py", line 638, in fileno
ValueError: I/O operation on closed file.
##[error]Process completed with exit code 255.

This project can work fine on the local.

DeploymenRelease Ubuntu investigate

Most helpful comment

@BrightRan @swissspidy Hello,
I was not able to reproduce the issue anywhere except GitHub Actions, most probably it is related to specific implementation of Github agents job execution. However, we found very similar git hub issue with the same problem and it was fixed by adding -T flag to docker-compose exec app pytest like in example below:

docker-compose exec -T app pytest

I have tested this workaround in the public repository provided, and it works fine

All 5 comments

If it helps with investigation, I'm running into the same issue with https://github.com/google/web-stories-wp/pull/1399, where I intend to use Docker to spin up a website for testing.

@BrightRan @swissspidy Hello,
I was not able to reproduce the issue anywhere except GitHub Actions, most probably it is related to specific implementation of Github agents job execution. However, we found very similar git hub issue with the same problem and it was fixed by adding -T flag to docker-compose exec app pytest like in example below:

docker-compose exec -T app pytest

I have tested this workaround in the public repository provided, and it works fine

@Darleev ,
Great! I also tested on my side, it works.
Thanks very much for sharing your solution.

Yep, that -T option does the trick. Thanks for quick actions on this!

@villekr I am glad that this solution helped.
In case of any questions, do not hesitate to contact us.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mcooley picture mcooley  路  3Comments

ethomson picture ethomson  路  4Comments

MSP-Greg picture MSP-Greg  路  3Comments

frankieroberto picture frankieroberto  路  4Comments

Tnze picture Tnze  路  4Comments