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

Import and calling class from a different file that is initialized with parameters should be working #143

Closed
aredz opened this issue Jun 5, 2019 · 2 comments
Assignees
Labels

Comments

@aredz
Copy link

aredz commented Jun 5, 2019

Description

There should be no errors when importing and calling parameterized class if argument has been specified. This was working on previous version of step_impl.py

Steps to reproduce

  1. Add a new class with parameter from another file
  2. import to current implementation
  3. Call imported class with parameter

Information that will help us debug

Here's the trace:

`Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\AutomatedTestProjects\Sample2> gauge run --tags "single word"
You are using pip version 19.0.3, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Exception occurred while loading step implementations from file: step_impl\models\vowels.py.
Traceback (most recent call last):
File "C:\Users\user1\AppData\Local\Programs\Python\Python37-32\lib\site-packages\getgauge\impl_loader.py", line 67, in _import_file
update_step_resgistry_with_class(c1, file_path) # c1 will create a new instance of the class
TypeError: init() missing 1 required positional argument: 'input'

Exception occurred while loading step implementations from file: step_impl\models\vowels2.py.

Specification Heading

Traceback (most recent call last):
File "C:\Users\user1\AppData\Local\Programs\Python\Python37-32\lib\site-packages\getgauge\impl_loader.py", line 67, in _import_file
update_step_resgistry_with_class(c1, file_path) # c1 will create a new instance of the class
TypeError: init() missing 1 required positional argument: 'input'

Vowel counts in single word

Model 1 : aeiou P

Model 2 : aeiou

Model 3 : aeiou

Model 4 : aeiou
P

Successfully generated html-report to => C:\AutomatedTestProjects\Sample2\reports\html-report\index.html
Specifications: 1 executed 1 passed 0 failed 0 skipped
Scenarios: 1 executed 1 passed 0 failed 0 skipped

Total time taken: 43ms
PS C:\AutomatedTestProjects\Sample2> `

Gauge version: 1.0.4
Commit Hash: 3a9a647

Plugins

html-report (4.0.8)
json-report (0.3.0)
python (0.3.5)
screenshot (0.0.1)
spectacle (0.1.3)
xml-report (0.2.1)

Python 3.7.3

pip list
Package Version


alabaster 0.7.12
appdirs 1.4.3
Babel 2.6.0
baron 0.7
certifi 2018.10.15
chardet 3.0.4
colorama 0.4.0
docutils 0.14
getgauge 0.3.4
grpcio 1.15.0
idna 2.7
imagesize 1.1.0
Jinja2 2.10.1
Markdown 3.0.1
MarkupSafe 1.1.1
numpy 1.16.1
packaging 19.0
pandas 0.24.1
parso 0.3.1
pip 19.1.1
prettytable 0.7.2
protobuf 3.6.1
ptvsd 3.0.0
Pycco 0.6.0
Pygments 2.2.0
pyparsing 2.3.1
pypyodbc 1.3.4
pystache 0.5.4
python-dateutil 2.8.0
pytz 2018.9
redbaron 0.7.1
requests 2.19.1
rply 0.7.6
selenium 3.14.1
setuptools 39.0.1
six 1.11.0
smartypants 2.0.1
snowballstemmer 1.2.1
Sphinx 2.0.0
sphinxcontrib-applehelp 1.0.1
sphinxcontrib-devhelp 1.0.1
sphinxcontrib-htmlhelp 1.0.1
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.2
sphinxcontrib-serializinghtml 1.1.3
urllib3 1.23

OS: Windows 10 Enterprise 64-Bit (10.0, Build 18362)
Sample2.zip

Screenshot samples:
Project:
image
Class Model 1 and Class Model 2:
image
Class Model 3:
image

@aredz
Copy link
Author

aredz commented Jun 5, 2019

I've modified the vowels project and attached the sample project for you guys.
From the sample (the first two(2) Model ( 1 and 2) Calls are failing having warnings. Sample Calls for Model 3 is working (because this is the workaround I did now).

Though, I do not want to make these parameter calls always "optional" if they are required. I don't want to actually do that for every class I've done so far(but I'm already starting, since it is becoming a bit noticeable now, having the warning show in the build and release pipelines in azure).

if you could check out what can be done there, many thanks.

@Debashis9012
Copy link
Contributor

This issue has been verified and found fixed with the latest gauge-python nightly version: python (0.3.6.nightly-2019-06-27)

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

No branches or pull requests

4 participants