tox.ini 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Tox (http://tox.testrun.org/) is a tool for running tests
  2. # in multiple virtualenvs. This configuration file will run the
  3. # test suite on all supported python versions and providers.
  4. # To use it, "pip install tox" and then run "tox" from this directory.
  5. # You will have to set all required environment variables (below) before
  6. # running the tests.
  7. [tox]
  8. envlist = py3.13-{aws,azure,gcp,openstack,mock},lint
  9. [testenv]
  10. commands = # see pyproject.toml for coverage options; setup.cfg for flake8
  11. # Azure integration tests race on the shared default vnet/subnet
  12. # under xdist (get_or_create_default has no locking, so two workers
  13. # creating the same named resource conflict on Azure ARM). Run the
  14. # azure factor serially; other providers stay parallel.
  15. !azure: coverage run --source=cloudbridge -m pytest -v {posargs:-n 5 tests/}
  16. azure: coverage run --source=cloudbridge -m pytest -v {posargs:tests/}
  17. # Combine parallel-mode data files and emit Cobertura XML for upload
  18. # by coverallsapp/github-action in CI. Locally this produces
  19. # coverage.xml in the project root, which IDEs can also consume.
  20. coverage combine
  21. coverage xml
  22. setenv =
  23. # Fix for moto import issue: https://github.com/travis-ci/travis-ci/issues/7940
  24. BOTO_CONFIG=/dev/null
  25. aws: CB_TEST_PROVIDER=aws
  26. azure: CB_TEST_PROVIDER=azure
  27. gcp: CB_TEST_PROVIDER=gcp
  28. openstack: CB_TEST_PROVIDER=openstack
  29. mock: CB_TEST_PROVIDER=mock
  30. # https://github.com/nedbat/coveragepy/issues/883#issuecomment-650562896
  31. COVERAGE_FILE=.coverage.{envname}
  32. passenv =
  33. PYTHONUNBUFFERED
  34. aws: CB_IMAGE_AWS
  35. aws: CB_VM_TYPE_AWS
  36. aws: CB_PLACEMENT_AWS
  37. # Standard boto3 credential env vars — set by aws-actions/configure-aws-credentials
  38. # in CI (OIDC) and by `aws configure` locally. Required because tox does not
  39. # forward arbitrary env vars to the test process.
  40. aws: AWS_ACCESS_KEY_ID
  41. aws: AWS_SECRET_ACCESS_KEY
  42. aws: AWS_SESSION_TOKEN
  43. aws: AWS_REGION
  44. aws: AWS_DEFAULT_REGION
  45. # Cloudbridge-specific names, kept for backward compatibility with local dev
  46. # configs that set these.
  47. aws: AWS_ACCESS_KEY
  48. aws: AWS_SECRET_KEY
  49. azure: CB_IMAGE_AZURE
  50. azure: CB_VM_TYPE_AZURE
  51. azure: AZURE_SUBSCRIPTION_ID
  52. azure: AZURE_CLIENT_ID
  53. azure: AZURE_SECRET
  54. azure: AZURE_TENANT
  55. azure: AZURE_REGION_NAME
  56. azure: AZURE_RESOURCE_GROUP
  57. azure: AZURE_STORAGE_ACCOUNT
  58. azure: AZURE_VM_DEFAULT_USER_NAME
  59. azure: AZURE_PUBLIC_KEY_STORAGE_TABLE_NAME
  60. gcp: CB_IMAGE_GCP
  61. gcp: CB_VM_TYPE_GCP
  62. gcp: CB_PLACEMENT_GCP
  63. gcp: GCP_DEFAULT_REGION
  64. gcp: GCP_DEFAULT_ZONE
  65. gcp: GCP_PROJECT_NAME
  66. gcp: GCP_SERVICE_CREDS_FILE
  67. gcp: GCP_SERVICE_CREDS_DICT
  68. openstack: CB_IMAGE_OS
  69. openstack: CB_VM_TYPE_OS
  70. openstack: CB_PLACEMENT_OS
  71. openstack: OS_AUTH_URL
  72. openstack: OS_PASSWORD
  73. openstack: OS_PROJECT_NAME
  74. openstack: OS_TENANT_NAME
  75. openstack: OS_USERNAME
  76. openstack: OS_REGION_NAME
  77. openstack: OS_USER_DOMAIN_NAME
  78. openstack: OS_PROJECT_DOMAIN_NAME
  79. openstack: NOVA_SERVICE_NAME
  80. openstack: OS_APPLICATION_CREDENTIAL_ID
  81. openstack: OS_APPLICATION_CREDENTIAL_SECRET
  82. mock: CB_IMAGE_AWS
  83. mock: CB_VM_TYPE_AWS
  84. mock: CB_PLACEMENT_AWS
  85. mock: AWS_ACCESS_KEY
  86. mock: AWS_SECRET_KEY
  87. deps =
  88. -rrequirements.txt
  89. coverage
  90. pytest-xdist
  91. [testenv:lint]
  92. commands = flake8 cloudbridge tests
  93. deps = flake8