4343from hashlib import sha1
4444import inspect
4545
46- __version__ = '1.7.3 '
46+ __version__ = '1.7.4 '
4747
4848_LOGGER = logging .getLogger ('tftest' )
4949
@@ -315,7 +315,8 @@ class TerraformTest(object):
315315 the directory of the python file that instantiates this class
316316 """
317317
318- def __init__ (self , tfdir , basedir = None , binary = 'terraform' , env = None , enable_cache = False , cache_dir = None ):
318+ def __init__ (self , tfdir , basedir = None , binary = 'terraform' , env = None ,
319+ enable_cache = False , cache_dir = None ):
319320 """Set Terraform folder to operate on, and optional base directory."""
320321 self ._basedir = basedir or os .getcwd ()
321322 self .binary = binary
@@ -376,6 +377,7 @@ def _abspath(self, path):
376377 return path if os .path .isabs (path ) else os .path .join (self ._basedir , path )
377378
378379 def _cache (func ):
380+
379381 def cache (self , ** kwargs ):
380382 """
381383 Runs the tftest instance method or retreives the cache value if it exists
@@ -399,8 +401,7 @@ def cache(self, **kwargs):
399401
400402 params = {
401403 ** {
402- k : v
403- for k , v in self .__dict__ .items ()
404+ k : v for k , v in self .__dict__ .items ()
404405 # only uses instance attributes that are involved in the results of
405406 # the decorated method
406407 if k in ["binary" , "_basedir" , "tfdir" , "env" ]
@@ -409,8 +410,8 @@ def cache(self, **kwargs):
409410 }
410411
411412 hash_filename = sha1 (
412- json .dumps (params , sort_keys = True , default = str ). encode ( "cp037" )
413- ).hexdigest () + ".pickle"
413+ json .dumps (params , sort_keys = True ,
414+ default = str ). encode ( "cp037" ) ).hexdigest () + ".pickle"
414415
415416 cache_key = cache_dir / hash_filename
416417 _LOGGER .debug ("Cache key: %s" , cache_key )
@@ -437,6 +438,7 @@ def cache(self, **kwargs):
437438 pickle .dump (out , f , pickle .HIGHEST_PROTOCOL )
438439
439440 return out
441+
440442 return cache
441443
442444 @_cache
@@ -596,7 +598,8 @@ def apply(self, input=False, color=False, auto_approve=True, tf_vars=None,
596598 return self .execute_command ('apply' , * cmd_args ).out
597599
598600 @_cache
599- def output (self , name = None , color = False , json_format = True , use_cache = False , ** kw ):
601+ def output (self , name = None , color = False , json_format = True , use_cache = False ,
602+ ** kw ):
600603 """Run Terraform output command."""
601604 cmd_args = []
602605 if name :
@@ -715,8 +718,8 @@ def __init__(self, tfdir, basedir=None, binary='terragrunt', env=None,
715718 cache_dir: optional base directory to use for caching, defaults to
716719 the directory of the python file that instantiates this class
717720 """
718- TerraformTest .__init__ (self , tfdir , basedir , binary ,
719- env , enable_cache , cache_dir )
721+ TerraformTest .__init__ (self , tfdir , basedir , binary , env , enable_cache ,
722+ cache_dir )
720723 self .tg_run_all = tg_run_all
721724 if self .tg_run_all :
722725 self ._plan_formatter = partial (_parse_run_all_out ,
0 commit comments