Orthanc Test Patch

Hi Team,

I’ve been having difficulties running the orthanc tests locally on my Mac. I pinpointed the issue with the following:

 subprocess.run(["docker", "compose", "-f", "docker-compose-transfers-concurrency.yml", "down", "-v", "--remove-orphans"], 
                       env= {
                           "ORTHANC_IMAGE_UNDER_TESTS": Helpers.orthanc_under_tests_docker_image
                       },
                       check=True)

The issue is that by setting env=... this overrides the parent process env, removing required env vars for docker to run correctly. In my case, it leads to “file not found” exceptions.

I would suggest the following

        subprocesss_env = os.environ.copy()
        subprocesss_env["ORTHANC_IMAGE_UNDER_TESTS"] = Helpers.orthanc_under_tests_docker_image
        subprocess.run(["docker", "compose", "-f", "docker-compose-transfers-concurrency.yml", "down", "-v", "--remove-orphans"], 
                       env=subprocesss_env, check=True)

Which creates a copy of the current process environment, adds the new var and then calls docker with this env copy. This allows docker to run (at least in my environment).

Hope this helps.

Cheers,

James

1 Like

Hi James,

Patch accepted and thanks a lot !

Alain

1 Like

Hi Alain,
I just ran into the same issue in test_pg_upgrades.py. I did a search, but I think this is the last reference to the same pattern.
James

Done here :white_check_mark: .

1 Like