Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@before_step, @after_step execution hooks do not work (gauge 0.9.0, gauge-python 0.2.0) #11

Closed
afeique opened this issue Jul 28, 2017 · 3 comments

Comments

@afeique
Copy link

afeique commented Jul 28, 2017

Description

Running the example test after gauge init python (0.9.0) with an empty @before_step() or @after_step() hook results in an error. This problem does not occur e.g. with the Ruby language runner using gauge init ruby.

Expected behavior: no error, all tests run and pass OK

Actual behavior:

$ gauge run
Python: 3.6.1
Exception occurred while loading step implementations from file: step_impl\step_impl.py.
Traceback (most recent call last):
  File "C:\conda3\lib\site-packages\getgauge\impl_loader.py", line 50, in import_file
    importlib.import_module(os.path.splitext(rel_path.replace(os.path.sep, '.'))[0])
  File "C:\conda3\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "C:\bdd-demo\test\step_impl\step_impl.py", line 40, in <module>
    @before_step()
TypeError: before_step() missing 1 required positional argument: 'obj'

# Specification Heading
  ## Vowel counts in single word         P P
  ## Vowel counts in multiple word       P P

Successfully generated html-report to => C:\bdd-demo\test\reports\html-report
Specifications: 1 executed      1 passed        0 failed        0 skipped
Scenarios:      2 executed      2 passed        0 failed        0 skipped

Total time taken: 140ms

Steps to reproduce

  1. Create a directory, run gauge init python in it
  2. Append to step_impl/step_impl.py:
@before_step()
def before_step_hook():
	pass
  1. Run example test using gauge run

Version Information

  • Gauge version: 0.9.0
  • Gauge Python plugin version: 0.2.0
  • Python version: 3.6.1 (anaconda)
  • getgauge package version: 0.2.0
  • OS information: Windows 7 x64
@afeique afeique changed the title @before_step, @after_step execution hooks do not work (python 3.6, gauge-python @before_step, @after_step execution hooks do not work (python 3.6, gauge-python 0.2.0) Jul 28, 2017
@afeique afeique changed the title @before_step, @after_step execution hooks do not work (python 3.6, gauge-python 0.2.0) @before_step, @after_step execution hooks do not work (gauge-python 0.2.0) Jul 28, 2017
@afeique afeique changed the title @before_step, @after_step execution hooks do not work (gauge-python 0.2.0) @before_step, @after_step execution hooks do not work (gauge 0.9.0, gauge-python 0.2.0) Jul 28, 2017
@kashishm
Copy link
Collaborator

@afeique Thanks for logging this issue. As a workaround, can you use hooks without the round brackets. Example:

@before_step
def before_step_hook():
	pass

@afeique
Copy link
Author

afeique commented Jul 28, 2017

@kashishm Thanks! That solves my problem for now. I appreciate it!

@kashishm
Copy link
Collaborator

Fixed in Gauge Python 0.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants