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

AttributeError: 'PythonNode' object has no attribute 'value' #140

Closed
max90727 opened this issue May 21, 2019 · 6 comments
Closed

AttributeError: 'PythonNode' object has no attribute 'value' #140

max90727 opened this issue May 21, 2019 · 6 comments
Assignees

Comments

@max90727
Copy link

max90727 commented May 21, 2019

Description

Expect behavior, gauge server runs after the command 'gauge run '

Steps to reproduce

  1. run command 'gauge run '

Information that will help us debug

  • Gauge version
    Gauge version: 1.0.5
    Commit Hash: 562f036

Plugins

html-report (4.0.8)
python (0.3.5)
screenshot (0.0.1)

  • Python version
    Python 3.6.8

  • getgauge package version, run pip3 show getgauge to get it
    Version: 0.3.5
    Summary: Enables Python support for Gauge
    Home-page: https://github.com/getgauge/gauge-python
    Author: Gauge Team

  • OS information
    Win10

Error Msg:
File "start.py", line 67, in
main()
File "start.py", line 26, in main
load_implementations()
File "start.py", line 35, in load_implementations
load_files(d)
File "Python\Python36\site-packages\getgauge\static_loader.py", line 26, in load_files
load_steps(pf)
File "Python\Python36\site-packages\getgauge\static_loader.py", line 7, in load_steps
for funcStep in python_file.iter_steps():
File "Python\Python36\site-packages\getgauge\parser_parso.py", line 81, in iter_steps
for func, decorator in self._iter_step_func_decorators():
File "Python\Python36\site-packages\getgauge\parser_parso.py", line 55, in _iter_step_func_decorators
if decorator.children[1].value == 'step':
AttributeError: 'PythonNode' object has no attribute 'value'

@shubhamsc
Copy link
Contributor

@max90727 Can you give more details about how are you getting this error. Are you created any project or worked with sample project.

Provide complete steps which you follow before running the gauge test. That will helpful to replicate the issue. How did you -

  1. Install gauge and plugin?
  2. Create the project?
  3. Running gauge (from: Command line or IDE)?

@max90727
Copy link
Author

max90727 commented May 22, 2019

@shubhamsc

  1. Install gauge and plugin?
    choco install gauge (installed 1.0.3)
    choco update gauge (update to 1.0.4)
    gauge install python

  2. Create the project?
    gauge init python

  3. Running gauge
    gauge run specs (command line)

In my specs implement, one of the imported files has @value.setter.
I noticed that error did not show up after I removed the setter. However, I need the setter for the value. To be more clear here is the directory looks like.

specs/
step_impl/step_impl.py
step_impl/library.py (@value.setter is here)

@max90727
Copy link
Author

Sorry. I clicked the wrong button. Not closed

@max90727 max90727 reopened this May 22, 2019
@BugDiver
Copy link
Member

@max90727 Thanks for reporting the issue. I am able to replicate it at my end. We will be fixing this issue soon.

Steps to replicate

  • gauge init python
  • Add following impl inside a file (in the impl dir)
class Foo:

    def __init__(self,x):
        self.x = x

    @property
    def x(self):
        return self.__x

    @x.setter
    def x(self, x):
       self.__x = x
  • gauge run specs

Dev Notes

The issue is happening because the static parser is trying to read all the decorators while parsing the file.

@shubhamsc
Copy link
Contributor

The fix should be available in nightly >= 28-05-2019

@max90727
Copy link
Author

The latest nightly build solved the issue.
Thank you.

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

3 participants