Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[error]Process completed with exit code 5. #233

Closed
timmy61109 opened this issue Nov 28, 2019 · 73 comments
Closed

[error]Process completed with exit code 5. #233

timmy61109 opened this issue Nov 28, 2019 · 73 comments

Comments

@timmy61109
Copy link

Hello, I use GitHub Actions to check my Python program and use your script as an example. Although I have modified it, I may also modify it wrong, but I found that whether it is modified by you or myself, After creating on Azure DevOps Pipelines, the following error message will appear, but I do n’t know why, after querying the Internet.

Installing collected packages: attrs, more-itertools, zipp, importlib-metadata, pluggy, six, pyparsing, packaging, wcwidth, py, pytest
Successfully installed attrs-19.3.0 importlib-metadata-0.23 more-itertools-7.2.0 packaging-19.2 pluggy-0.13.1 py-1.8.0 pyparsing-2.4.5 pytest-5.3.1 six-1.13.0 wcwidth-0.1.7 zipp-0.6.0
============================= test session starts ==============================
platform linux -- Python 3.7.5, pytest-5.3.1, py-1.8.0, pluggy-0.13.1
rootdir: /home/runner/work/Introduction-to-Programming-Using-Python/Introduction-to-Programming-Using-Python
collected 0 items

============================ no tests ran in 0.48s =============================
##[error]Process completed with exit code 5.

But I do n’t know why this is the case. There is no clear answer to the query on the Internet. It may be related to the setting of the container. I feel that I do not have permission to write to the files generated by pytest or flake8.

The following is my script. Although there are some problems after the modification, it started with the example provided by this project:
pythonpackage.yml
pythonapp.yml

This is the output:
GitHub Actions of Introduction-to-Programming-Using-Python

Above is Google Translate

@Diima7
Copy link

Diima7 commented Dec 22, 2019

I have the same Problem

@timmy61109
Copy link
Author

@Diima7 I've solved it, maybe I can help you solve it.

@ysfchn
Copy link

ysfchn commented Jan 6, 2020

@timmy61109 Can you say how did you solved it? It would be helpful for me and people who coming from search results.

@timmy61109
Copy link
Author

timmy61109 commented Jan 7, 2020

I can help your CI work with actual actions. I can forked your repository, and then helped you to fix the mistakes, then pull the request and tell why, so of course you can ask questions about the changes.

Translated by Google Translator

@timmy61109
Copy link
Author

timmy61109 commented Jan 9, 2020

The deployment can use Flake8 and Pylint to do Lint first. Pytest needs to write a module. Through this module to check other modules and functions, so Pytest will be more difficult, that is, he will need to call for other programs ,E.g:

image

Therefore, Pytest is used to check functions, and even function check functions. At present, the environments provided by major platforms do not allow dry run, so the above problems occur.

Such as using Pylint and Flake8 are static checks, so they can be fully implemented, for example:

image

image

So I can help your CI work with actual actions. I can forked your repository, and then helped you to fix the mistakes, then pull the request and tell why, so of course you can ask questions about the changes.

Translated by Google Translator

@ysfchn
Copy link

ysfchn commented Jan 9, 2020

@timmy61109 That would be cool, I actually need help setting CI about my repository called AI-Kit 😁

@timmy61109
Copy link
Author

timmy61109 commented Jan 9, 2020

@ysfchn You can give me the repository you need to build, I can help you build it, I will use Pylint and Flake8 first, and then you need to tell me how you need to call your function, or you can write your own check Program.

Translated by Google Translator

@JavascriptLearner815
Copy link

JavascriptLearner815 commented Aug 16, 2020

Same problem. Exactly same problem.

@timmy61109
Copy link
Author

timmy61109 commented Aug 16, 2020

Mine is related to this, I made a workflow with the python starter workflow and it returned exit code 5.

@JavascriptLearner815 I can help you, but I need you to tell me which project is yours.

As explained earlier, the test project pytest is required to operate normally.

I think you are playing Minecraft, I have an idea about a Minecraft server, if you are willing to listen to it.

@timmy61109
Copy link
Author

https://github.com/JavascriptLearner815/The-Dean-Site/actions/runs/210487668

I found that you don’t have Python code and packages to provide checks. For Pytest, you need Python code to provide checks.

@timmy61109
Copy link
Author

@JavascriptLearner815 Do you need to develop any software or features? Maybe I will be interested.

@JavascriptLearner815
Copy link

So I added a very, very tiny bit of code into it, and it again said in pytest returned exit code 5.

Are Windows and GitHub exit codes different?

I mean, GitHub Actions is kind of simulating a terminal here, and noticing that it says the same message twice, it might be what I think it is - access is denied.

@timmy61109
Copy link
Author

timmy61109 commented Aug 18, 2020

@JavascriptLearner815

Maybe you can open a new branch in your project and put your small code on it. I can demonstrate how to run Pytest on it according to your code.

Then Windows exits are the same, which is what I can guarantee to you.

At the beginning I thought the reason was the same as you thought, but in fact it is not a problem of permissions, it is because of dry running.

@PouekDEV
Copy link

PouekDEV commented Nov 6, 2020

I have same problem my repository https://github.com/PouekDEV/ChamsterBot/runs/1362577358

@timmy61109
Copy link
Author

I have same problem my repository https://github.com/PouekDEV/ChamsterBot/runs/1362577358

I have looked at your repository because of dry run, and you have to write a test function for Pytest to check.

@timmy61109 timmy61109 reopened this Nov 6, 2020
@PouekDEV
Copy link

PouekDEV commented Nov 6, 2020

Ok nevermind I just got rid of this workflow

@timmy61109
Copy link
Author

Ok nevermind I just got rid of this workflow

I can help you, I already fork your repository

@PouekDEV
Copy link

PouekDEV commented Nov 7, 2020

Ok nevermind I just got rid of this workflow

I can help you, I already fork your repository

If you want but I don't need it anymore

@timmy61109
Copy link
Author

Ok nevermind I just got rid of this workflow

I can help you, I already fork your repository

If you want but I don't need it anymore

So you don’t want to continue your project?

@PouekDEV
Copy link

Ok nevermind I just got rid of this workflow

I can help you, I already fork your repository

If you want but I don't need it anymore

So you don’t want to continue your project?

I will continue project if I will have any idea what to add. This is whole point of what I'm making with it. I don't need anymore this workflow that is what i meant.

@timmy61109
Copy link
Author

I got it thanks

@PouekDEV
Copy link

I got it thanks

No problem

@erikfilias
Copy link

@timmy61109 , I have the same problem...But I don't know how to solve it since it said the imp module is deprecated.
Any idea? Thanks in advance.

Link: https://github.com/IIT-EnergySystemModels/openTEPES/runs/1473273369?check_suite_focus=true

@timmy61109
Copy link
Author

@timmy61109 , I have the same problem...But I don't know how to solve it since it said the imp module is deprecated.
Any idea? Thanks in advance.

Link: https://github.com/IIT-EnergySystemModels/openTEPES/runs/1473273369?check_suite_focus=true

I know why, you can refer to the following, I suggest you ignore it first.

PyUtilib/pyutilib#111

And your code is quite messy, it is recommended to write in accordance with PEP8 style.

@erikfilias
Copy link

And your code is quite messy, it is recommended to write in accordance with PEP8 style.

Thank you, I'll try to rewrite it.

@APratham
Copy link

APratham commented Dec 2, 2020

@timmy61109 Hi, I need a small help. This is a Twitter bot, can you please help me setup the workflow for this too? Maybe one of the reasons it is failing because it isn't a complete Python program maybe? Do I need to add something else to the repository? Also thank you so much for all the help you've been doing.

@moghimi
Copy link

moghimi commented Oct 29, 2021

I have same problem, I also added requirements.txt but the the workflow fails and it still returned exit code 5. https://github.com/moghimi/batch-translator/runs/4031928726?check_suite_focus=true

@moghimi Your problem is the same as everyone else, Pytest Run dry! So you need to make Pytest something to work.

Thanks, but you mean I have to write some tests with pytest or have to change my code?

@timmy61109
Copy link
Author

I have same problem, I also added requirements.txt but the the workflow fails and it still returned exit code 5. https://github.com/moghimi/batch-translator/runs/4031928726?check_suite_focus=true

@moghimi Your problem is the same as everyone else, Pytest Run dry! So you need to make Pytest something to work.

Thanks, but you mean I have to write some tests with pytest or have to change my code?

Yes

@vikas-15
Copy link

@timmy61109
Copy link
Author

i am also facing same error https://github.com/vikas-15/Demo-GitHub-Action/runs/6156677256?check_suite_focus=true

You need to have a program for it to run tests, currently your repository doesn't have anything related to Python, so you will get errors when running CI.

@TechWiz-3
Copy link

TechWiz-3 commented Jun 29, 2022

Just a little tip

If you guys can't figure out what's wrong, try out the commands from the workflow in a test environment or your own computer if possible.

The error could be something as simple as not being in the right directory, when you test it yourself it'll be much easier to figure out what's going on

@jrishabh731
Copy link

jrishabh731 commented Jul 7, 2022

I'm facing the same issue.

Error :
Run docker-compose exec -T api_server pytest /by/unittest/

============================= test session starts ==============================
platform linux -- Python 3.9.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /by
collected 0 items
============================ no tests ran in 0.00s =============================
Error: Process completed with exit code 5.

On local environment:

[root@rtm5 FastAPI_BlueYonder]# docker-compose exec -T api_server pytest /by/unittest/ -v
============================= test session starts ==============================
platform linux -- Python 3.9.13, pytest-7.1.2, pluggy-1.0.0 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /by
collecting ... collected 2 items

../unittest/testcase/test_api.py::test_get_engine_inspection PASSED [ 50%]
../unittest/testcase/test_api.py::test_post_engine_inspection PASSED [100%]

============================== 2 passed in 0.34s ===============================
[root@rtm5 FastAPI_BlueYonder]#

@TechWiz-3
Copy link

Is your repo private? I can't access the link and it doesn't show on your profile

@jrishabh731
Copy link

jrishabh731 commented Jul 7, 2022

I have made it public. Can you please have a look ?

@TechWiz-3
Copy link

Line 5 in test_api.py is sys.path.append("/by/source/") a real directory?

@jrishabh731
Copy link

Yeah. Its under the container.
Structure is
/by/source
/unittest

from unittest I was not able to call the source files or function thus added this path.

@jrishabh731
Copy link

Thanks for the efforts! I'm able to resolve it. The container was not running due to some host issues. Resolved that and it works.

@TechWiz-3
Copy link

Glad to hear that 😌 good work

@lomWs
Copy link

lomWs commented Jan 11, 2023

I have also the same error, can you help me please
link : https://github.com/lomWs/mp3_converter/actions/runs/3890088579/jobs/6638914895#step:6:14

@timmy61109
Copy link
Author

我也有同樣的錯誤,你能幫我嗎請 鏈接:https://github.com/lomWs/mp3_converter/actions/runs/3890088579/jobs/6638914895#step :6:14

OK, no problem

@timmy61109
Copy link
Author

@lomWs You, have not test program, so error

@yangwan-cw
Copy link

o damn it,thank for you , I have been solved.😊

@UnnormalPerson
Copy link

UnnormalPerson commented Jun 8, 2023

Hi! I am a newbie in both python and github and um would like to ask for help on why is my code not running with pytest. [I want to run Unstable.py (Its named like that only because I am having problems with the code and newly moved to github hoping people can help :) )] Link: https://github.com/UnnormalPerson/Scissors-Paper-Stone To whoever who can help, thanks a lot!
如果你不读英语,我是想说,我刚刚开始学用python和github,我写的代码有个问题,那就是pytest没收到哪一个代码,(Unstable.py),我不知道为什么会这样,有人可以帮帮我吗?(我没用狗哥翻译:))谢了! 对了,连接是:https://github.com/UnnormalPerson/Scissors-Paper-Stone
@timmy61109

@timmy61109
Copy link
Author

Hi! I am a newbie in both python and github and um would like to ask for help on why is my code not running with pytest. [I want to run Unstable.py (Its named like that only because I am having problems with the code and newly moved to github hoping people can help :) )] Link: https://github.com/UnnormalPerson/Scissors-Paper-Stone To whoever who can help, thanks a lot! 如果你不读英语,我是想说,我刚刚开始学用python和github,我写的代码有个问题,那就是pytest没收到哪一个代码,(Unstable.py),我不知道为什么会这样,有人可以帮帮我吗?(我没用狗哥翻译:))谢了! 对了,连接是:https://github.com/UnnormalPerson/Scissors-Paper-Stone @timmy61109

OK

我最近會花時間幫你看

@UnnormalPerson
Copy link

UnnormalPerson commented Jun 11, 2023

@timmy61109 经过一些更改我有可能把它弄得更乱,也不小心删除掉了,对不起!希望你能帮我把它回原。

@timmy61109
Copy link
Author

@timmy61109 经过一些更改我有可能把它弄得更乱,也不小心删除掉了,对不起!希望你能帮我把它回原。

好的

@timmy61109
Copy link
Author

基本上你的沒有測試程式也沒有對應的規則與資料,這樣一定會有錯誤

@timmy61109
Copy link
Author

你的程式是作什麼的?

@UnnormalPerson
Copy link

我只是有一写完一边把它试一下,因为我刚刚开始用这个程序,不会试自己写的东西。(Test Python code) 对不起我很笨:)

@yvonnegalusha
Copy link

Does pytest support opening text files and doing file comparisons in unit tests? My unit tests work in Spyder, but not github autograder. I assume it is the pytest environment that I do not have installed correctly. The tests exit with error: code 5 and here is my setup command: sudo -H pip3 install pytest pytest-openfiles
Any help is appreciated.

@timmy61109
Copy link
Author

pytest 是否支持在單元測試中打開文本文件並進行文件比較?我的單元測試可以在 Spyder 中運行,但不能在 github autograder 中運行。我認為這是我沒有正確安裝的pytest環境。測試退出時出現錯誤:代碼 5,這是我的設置命令: sudo -H pip3 install pytest pytest-openfiles 感謝任何幫助。

你可以提供你的程式碼,然後可以幫助您,只是最近很忙,通常幫助的方式都是會協助改寫測試檔案,因此最近只能告訴您錯誤原因,但無法實質幫助。

@timmy61109
Copy link
Author

我只是有一写完一边把它试一下,因为我刚刚开始用这个程序,不会试自己写的东西。(Test Python code) 对不起我很笨:)

測試程式是透過你提供一組資料,然後將資料丟進測試你撰寫的函式,如果資料一致回傳 True ,資料輸出結果是 False 就錯誤,這個是最簡單的測試方式。

@timmy61109
Copy link
Author

pytest 是否支持在單元測試中打開文本文件並進行文件比較?我的單元測試可以在 Spyder 中運行,但不能在 github autograder 中運行。我認為這是我沒有正確安裝的pytest環境。測試退出時出現錯誤:代碼 5,這是我的設置命令: sudo -H pip3 install pytest pytest-openfiles 感謝任何幫助。

Spyder 因為是整合環境,很有可能你在 github 上有缺少相依的套件,因此無法運行,這點要注意。

全新空白的環境壞處是要自己建構,好處是了解自己的軟體相依的最小套件是什麼

@timmy61109
Copy link
Author

我只是有一写完一边把它试一下,因为我刚刚开始用这个程序,不会试自己写的东西。(Test Python code) 对不起我很笨:)

我沒辦法看到你的專案了

@timmy61109
Copy link
Author

Does pytest support opening text files and doing file comparisons in unit tests? My unit tests work in Spyder, but not github autograder. I assume it is the pytest environment that I do not have installed correctly. The tests exit with error: code 5 and here is my setup command: sudo -H pip3 install pytest pytest-openfiles Any help is appreciated.

You can provide your program code and we can help you. It's just that I've been very busy lately.

In the past I've helped by rewriting the test files, so lately I've been able to tell you the cause of the error, but not actually help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests