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

Code changes for #349 and #350. #352

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

rahkumar651991
Copy link
Contributor

What does this PR do?

The PR enhances the performances to parse testcase before hostname than doing individually for all devices. It doesn't change the functionality just optimises it.
It also gives the developer an option to enhance logging which will be helpful in debugging process.

What issues does this PR fix or reference?

#349 and #350

Previous Behavior

Testcases were parsed everytime for multiple devices configured.

New Behavior

Testcases will be parsed once and then passed as an argument to all the devices to be connected.

Tests written?

Previous testcases were modified for new api.

@coveralls
Copy link

coveralls commented Jan 20, 2020

Pull Request Test Coverage Report for Build 286

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 110 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.1%) to 92.236%

Files with Coverage Reduction New Missed Lines %
/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/jnpr/jsnapy/jsnapy.py 22 93.29%
/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/jnpr/jsnapy/jsnapy.py 22 93.29%
/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/jnpr/jsnapy/jsnapy.py 22 93.29%
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/jnpr/jsnapy/jsnapy.py 22 93.29%
/home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/jnpr/jsnapy/jsnapy.py 22 93.29%
Totals Coverage Status
Change from base Build 285: -0.1%
Covered Lines: 7888
Relevant Lines: 8552

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jan 20, 2020

Pull Request Test Coverage Report for Build 305

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 80 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.1%) to 92.261%

Files with Coverage Reduction New Missed Lines %
/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/jnpr/jsnapy/jsnapy.py 20 93.91%
/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/jnpr/jsnapy/jsnapy.py 20 93.91%
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/jnpr/jsnapy/jsnapy.py 20 93.91%
/home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/jnpr/jsnapy/jsnapy.py 20 93.91%
Totals Coverage Status
Change from base Build 301: -0.1%
Covered Lines: 7916
Relevant Lines: 8580

💛 - Coveralls

gcasella and others added 3 commits January 31, 2020 09:36
* Update setup.py

I've noticed that this setup.py does not work when trying to execute
"pip install jsnapy" from a Python 3.X Virtual environment.

It appears that Python 3.X does not use the sys.real_prefix attribute any more.
I found some documentation here https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv showing that it is moved to base_prefix.

What i've added will check sys.base_prefix and compare it to sys.prefix, if it doesn't match, than you're in a virtual environment. 

Outside of VirtualEnv;

Gian-Lucas-MacBook-Pro:~ gianluca.casella$ python3.8
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.base_prefix
'/Library/Frameworks/Python.framework/Versions/3.8'
>>> sys.prefix
'/Library/Frameworks/Python.framework/Versions/3.8'
>>> quit()



Inside VirtualEnv:
Gian-Lucas-MacBook-Pro:~ gianluca.casella$ source venv/bin/activate
(venv) Gian-Lucas-MacBook-Pro:~ gianluca.casella$ python
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.base_prefix
'/Library/Frameworks/Python.framework/Versions/3.8'
>>> sys.prefix
'/Users/gianluca.casella/venv'

* Update setup.py

Updated typo on 

hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix))

* Update setup.py

Added line 75

* Update __init__.py

Modified line 29 to enable Python 3.X Support in Virtual Environments

* Update test_init.py

Modified line 39 to add Python 3.X Support for Virtual Environments

* Added the venv_check() function to the setup.py and lib/jnpr/jsnapy/__init__.py
* port support added for same Ip-address. Juniper#322

* port support added for same Ip-address. Juniper#322
@vnitinv
Copy link
Contributor

vnitinv commented Feb 3, 2020

@rahkumar651991 can you please resolve conflicts?

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

Successfully merging this pull request may close these issues.

7 participants