Fix "mutable" object as default value

This patch fix the coding issue where "mutable" objects like list, dict
are being used as default value of param.

Current functions with mutable object as default value can create issues
if they will be called in more random order.
For example - first call with non default value and then with default
value. In this case original default will be overridden by the first
function call (as mutable object keep their state among function calls).

This commit also add the hacking check for the same and its
corresponding test.

Closes-Bug: #1330322

Change-Id: I251b316ef6d37f4b95c5e8d73a20a39005c22870
This commit is contained in:
Ghanshyam
2014-06-16 13:54:22 +09:00
parent 6e418039c5
commit 2a180b8398
9 changed files with 89 additions and 22 deletions

View File

@@ -12,6 +12,7 @@ Tempest Specific Commandments
- [T104] Scenario tests require a services decorator
- [T105] Unit tests cannot use setUpClass
- [T106] vim configuration should not be kept in source files.
- [N322] Method's default argument shouldn't be mutable
Test Data/Configuration
-----------------------