Merge "Fix cleanup of default security group when preprov creds are used"
diff --git a/releasenotes/notes/deprecate-and-enable-identity-application_credentials-1d4eaef4c3c9dcba.yaml b/releasenotes/notes/deprecate-and-enable-identity-application_credentials-1d4eaef4c3c9dcba.yaml
new file mode 100644
index 0000000..4b31ff8
--- /dev/null
+++ b/releasenotes/notes/deprecate-and-enable-identity-application_credentials-1d4eaef4c3c9dcba.yaml
@@ -0,0 +1,17 @@
+---
+upgrade:
+  - |
+    Application credentials are supported by Keystone since Queens.
+    As Tempest currently supports only much newer OpenStack versions
+    (Ussuri or later), the configuration option which enables
+    application credentials testing
+    (``CONF.identity-feature-enabled.application_credentials``)
+    is now enabled by default.
+deprecations:
+  - |
+    Application credentials are supported by Keystone since Queens.
+    As Tempest currently supports only much newer OpenStack versions
+    (Ussuri or later), the configuration option which enables
+    application credentials testing
+    (``CONF.identity-feature-enabled.application_credentials``)
+    is now deprecated.
diff --git a/tempest/api/identity/v3/test_users.py b/tempest/api/identity/v3/test_users.py
index 6425ea9..dc6dd4a 100644
--- a/tempest/api/identity/v3/test_users.py
+++ b/tempest/api/identity/v3/test_users.py
@@ -77,6 +77,8 @@
         time.sleep(1)
         self.non_admin_users_client.auth_provider.set_auth()
 
+    @testtools.skipUnless(CONF.identity_feature_enabled.security_compliance,
+                          'Security compliance not available.')
     @decorators.idempotent_id('ad71bd23-12ad-426b-bb8b-195d2b635f27')
     @testtools.skipIf(CONF.identity_feature_enabled.immutable_user_source,
                       'Skipped because environment has an '
diff --git a/tempest/config.py b/tempest/config.py
index 3a497cb..fde52e4 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -261,12 +261,13 @@
     cfg.BoolOpt('project_tags',
                 default=False,
                 help='Is the project tags identity v3 API available?'),
-    # Application credentials is a default feature in Queens. This config
-    # option can removed once Pike is EOL.
     cfg.BoolOpt('application_credentials',
-                default=False,
+                default=True,
                 help='Does the environment have application credentials '
-                     'enabled?'),
+                     'enabled?',
+                deprecated_for_removal=True,
+                deprecated_reason='Application credentials is a default '
+                                  'feature since Queens'),
     # Access rules for application credentials is a default feature in Train.
     # This config option can removed once Stein is EOL.
     cfg.BoolOpt('access_rules',
diff --git a/tempest/tests/lib/cmd/test_check_uuid.py b/tempest/tests/lib/cmd/test_check_uuid.py
index a621a75..403de38 100644
--- a/tempest/tests/lib/cmd/test_check_uuid.py
+++ b/tempest/tests/lib/cmd/test_check_uuid.py
@@ -29,12 +29,13 @@
            "        pass"
 
     def create_tests_file(self, directory):
-        with open(directory + "/__init__.py", "w"):
-            pass
+        init_file = open(directory + "/__init__.py", "w")
+        init_file.close()
 
         tests_file = directory + "/tests.py"
         with open(tests_file, "w") as fake_file:
             fake_file.write(TestCLInterface.CODE)
+            fake_file.close()
 
         return tests_file