Skip to content

[question] Multithreaded support in a function #3320

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

Closed
Formartha opened this issue Mar 18, 2018 · 5 comments
Closed

[question] Multithreaded support in a function #3320

Formartha opened this issue Mar 18, 2018 · 5 comments
Labels
type: question general question, might be closed after 2 weeks of inactivity

Comments

@Formartha
Copy link

Hello,

I got some usecase where I will need some multithreaded support.
Basically, I got some implementation of a Rest API call which loades some .zip files.

The implementation basically scans a given directory and than it pushes the file to one API.

The main issue is that the time it takes to load a file is about 30 sec and I want to cut it down.
Multithreading this request might help, as it will open a thread per file and will send it to the server.

Do we have any limitation of doing it in pytest?
If so, care to assist with building it correctly?

Cheers,
Mor

@RonnyPfannschmidt
Copy link
Member

pytest itself is unaware of thread and not designed to support working with threads inside of itself

on the same page there is also zero issue with spinning up a thread pool and submitting work to it

for the use-case as you described, i believe just having a thread pool is more than sufficient,

@Formartha
Copy link
Author

Thank you for your response Ronny. I will deep dive into what you suggested.

Any plans to have some native threading support?

Plus,
Do you know any way to let Pycharm know I'm using an imported fixture? It shows that my module isnt being used (while importing it), however, it is used.

@RonnyPfannschmidt
Copy link
Member

@Formartha as far as i understand the pytest support of pycharm is simply unaware of key features of pytest, so no idea how to add it

@RonnyPfannschmidt RonnyPfannschmidt added the type: question general question, might be closed after 2 weeks of inactivity label Mar 19, 2018
@RonnyPfannschmidt
Copy link
Member

as for adding native threading support to pytest - thats highly unlikely as it very likely requires a complete rewrite of key parts

@nicoddemus
Copy link
Member

Do you know any way to let Pycharm know I'm using an imported fixture? It shows that my module isnt being used (while importing it), however, it is used.

You don't need to import fixtures in order to use them, mind you; you should put fixtures into a conftest.py file and pytest will find and inject them automatically in tests that need it.

I think we can close this for now, feel free to follow up with further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question general question, might be closed after 2 weeks of inactivity
Projects
None yet
Development

No branches or pull requests

3 participants