(tmpdir_factory)
| 263 | |
| 264 | @pytest.fixture(scope='session') |
| 265 | def azure_server(tmpdir_factory): |
| 266 | port = find_free_port() |
| 267 | env = os.environ.copy() |
| 268 | tmpdir = tmpdir_factory.getbasetemp() |
| 269 | # We only need blob service emulator, not queue or table. |
| 270 | args = ['azurite-blob', "--location", tmpdir, "--blobPort", str(port)] |
| 271 | # For old Azurite. We can't install the latest Azurite with old |
| 272 | # Node.js on old Ubuntu. |
| 273 | args += ["--skipApiVersionCheck"] |
| 274 | proc = None |
| 275 | try: |
| 276 | proc = subprocess.Popen(args, env=env) |
| 277 | # Make sure the server is alive. |
| 278 | if proc.poll() is not None: |
| 279 | pytest.skip(f"Command {args} did not start server successfully!") |
| 280 | except (ModuleNotFoundError, OSError) as e: |
| 281 | pytest.skip(f"Command {args} failed to execute: {e}") |
| 282 | else: |
| 283 | yield { |
| 284 | # Use the standard azurite account_name and account_key. |
| 285 | # https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator#authorize-with-shared-key-credentials |
| 286 | 'connection': ('127.0.0.1', port, 'devstoreaccount1', |
| 287 | 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2' |
| 288 | 'UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=='), |
| 289 | 'process': proc, |
| 290 | 'tempdir': tmpdir, |
| 291 | } |
| 292 | finally: |
| 293 | if proc is not None: |
| 294 | proc.kill() |
| 295 | proc.wait() |
| 296 | |
| 297 | |
| 298 | @pytest.fixture( |
nothing calls this directly
no test coverage detected