Skip to content
This repository was archived by the owner on May 29, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kevlened/pytest-parallel
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: voltusdev/pytest-parallel
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on May 23, 2020

  1. Add PYTEST_PARALLEL_PROCESS

    maxmcd committed May 23, 2020
    Copy the full SHA
    868f69d View commit details
Showing with 5 additions and 3 deletions.
  1. +5 −3 pytest_parallel/__init__.py
8 changes: 5 additions & 3 deletions pytest_parallel/__init__.py
Original file line number Diff line number Diff line change
@@ -56,12 +56,14 @@ def run_test(session, item, nextitem):
raise session.Interrupted(session.shouldstop)


def process_with_threads(config, queue, session, tests_per_worker, errors):
def process_with_threads(config, queue, session, tests_per_worker, errors, index):
# This function will be called from subprocesses, forked from the main
# pytest process. First thing we need to do is to change config's value
# so we know we are running as a worker.
config.parallel_worker = True

os.environ["PYTEST_PARALLEL_PROCCESS"] = str(index)

threads = []
for _ in range(tests_per_worker):
thread = ThreadWorker(queue, session, errors)
@@ -296,8 +298,8 @@ def wait_for_responses_processor():
# This flag will be changed after the worker's fork.
self._config.parallel_worker = False

args = (self._config, queue, session, tests_per_worker, errors)
for _ in range(self.workers):
for i in range(self.workers):
args = (self._config, queue, session, tests_per_worker, errors, i)
process = Process(target=process_with_threads, args=args)
process.start()
processes.append(process)