tox.ini 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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,pypy}-{aws,azure,gcp,openstack,mock},lint
  9. [testenv]
  10. commands = # see pyproject.toml for coverage options; setup.cfg for flake8
  11. coverage run --source=cloudbridge -m pytest -v {posargs:-n 5 tests/}
  12. # Combine parallel-mode data files and emit Cobertura XML for upload
  13. # by coverallsapp/github-action in CI. Locally this produces
  14. # coverage.xml in the project root, which IDEs can also consume.
  15. coverage combine
  16. coverage xml
  17. setenv =
  18. # Fix for moto import issue: https://github.com/travis-ci/travis-ci/issues/7940
  19. BOTO_CONFIG=/dev/null
  20. aws: CB_TEST_PROVIDER=aws
  21. azure: CB_TEST_PROVIDER=azure
  22. gcp: CB_TEST_PROVIDER=gcp
  23. openstack: CB_TEST_PROVIDER=openstack
  24. mock: CB_TEST_PROVIDER=mock
  25. # https://github.com/nedbat/coveragepy/issues/883#issuecomment-650562896
  26. COVERAGE_FILE=.coverage.{envname}
  27. passenv =
  28. PYTHONUNBUFFERED
  29. aws: CB_IMAGE_AWS
  30. aws: CB_VM_TYPE_AWS
  31. aws: CB_PLACEMENT_AWS
  32. # Standard boto3 credential env vars — set by aws-actions/configure-aws-credentials
  33. # in CI (OIDC) and by `aws configure` locally. Required because tox does not
  34. # forward arbitrary env vars to the test process.
  35. aws: AWS_ACCESS_KEY_ID
  36. aws: AWS_SECRET_ACCESS_KEY
  37. aws: AWS_SESSION_TOKEN
  38. aws: AWS_REGION
  39. aws: AWS_DEFAULT_REGION
  40. # Cloudbridge-specific names, kept for backward compatibility with local dev
  41. # configs that set these.
  42. aws: AWS_ACCESS_KEY
  43. aws: AWS_SECRET_KEY
  44. azure: CB_IMAGE_AZURE
  45. azure: CB_VM_TYPE_AZURE
  46. azure: AZURE_SUBSCRIPTION_ID
  47. azure: AZURE_CLIENT_ID
  48. azure: AZURE_SECRET
  49. azure: AZURE_TENANT
  50. azure: AZURE_REGION_NAME
  51. azure: AZURE_RESOURCE_GROUP
  52. azure: AZURE_STORAGE_ACCOUNT
  53. azure: AZURE_VM_DEFAULT_USER_NAME
  54. azure: AZURE_PUBLIC_KEY_STORAGE_TABLE_NAME
  55. gcp: CB_IMAGE_GCP
  56. gcp: CB_VM_TYPE_GCP
  57. gcp: CB_PLACEMENT_GCP
  58. gcp: GCP_DEFAULT_REGION
  59. gcp: GCP_DEFAULT_ZONE
  60. gcp: GCP_PROJECT_NAME
  61. gcp: GCP_SERVICE_CREDS_FILE
  62. gcp: GCP_SERVICE_CREDS_DICT
  63. openstack: CB_IMAGE_OS
  64. openstack: CB_VM_TYPE_OS
  65. openstack: CB_PLACEMENT_OS
  66. openstack: OS_AUTH_URL
  67. openstack: OS_PASSWORD
  68. openstack: OS_PROJECT_NAME
  69. openstack: OS_TENANT_NAME
  70. openstack: OS_USERNAME
  71. openstack: OS_REGION_NAME
  72. openstack: OS_USER_DOMAIN_NAME
  73. openstack: OS_PROJECT_DOMAIN_NAME
  74. openstack: NOVA_SERVICE_NAME
  75. openstack: OS_APPLICATION_CREDENTIAL_ID
  76. openstack: OS_APPLICATION_CREDENTIAL_SECRET
  77. mock: CB_IMAGE_AWS
  78. mock: CB_VM_TYPE_AWS
  79. mock: CB_PLACEMENT_AWS
  80. mock: AWS_ACCESS_KEY
  81. mock: AWS_SECRET_KEY
  82. deps =
  83. -rrequirements.txt
  84. coverage
  85. pytest-xdist
  86. [testenv:lint]
  87. commands = flake8 cloudbridge tests
  88. deps = flake8