Custom Search

SUBSCRIBE

SUBSCRIBE : 300 + Free Video Tutorials Programming (Python, golang, Julia), DevOps

Monday, December 8, 2014

Setting Up OpenStack Python Client Development Environment

1)
Clone the Project

#git clone https://github.com/openstack/python-keystoneclient.git

2)
Goto cloned directory

#cd python-keystoneclient



3)
Setup the Environment


3,a)
With run_tests.sh

#./run_tests.sh

OR

3,b)
With tox

#sudo pip install tox
#tox

4)
Run the client commands


4,a)
With run_tests.sh Environment


4,a,a)Goto cloned directory
#cd python-keystoneclient

4,a,b)
Create a script named "keystone" with following statements in cloned directory.
#vim keystone

#!/usr/bin/python
# PBR Generated from 'console_scripts'
import sys
from keystoneclient.shell import main
if __name__ == "__main__":
    sys.exit(main())


4,a,c)
Run the keystone client commands from run_tests.sh Environment
#source .venv/bin/activate
#.venv/bin/python keystone tenant-list
#.venv/bin/python keystone user-list


OR

4,b)
With Tox Environment

4,b,a)
Goto cloned directory
#cd python-keystoneclient

4,b,b)
Create a script named "keystone" with following statements in cloned directory.
#vim keystone

#!/usr/bin/python
# PBR Generated from 'console_scripts'
import sys
from keystoneclient.shell import main
if __name__ == "__main__":
    sys.exit(main())


4,b,c)
Run the keystone client commands from Tox Environment
#source .tox/py27/bin/activate
#.tox/py27/bin/python keystone tenant-list
#.tox/py27/bin/python keystone user-list


5)
Run the Tests


5,a)
With run_tests.sh
#./run_tests.sh --debug keystoneclient.tests.v2_0.test_tenants.TenantTests.test_list

##Only pep8 test
#./run_tests.sh --debug --pep8 keystoneclient.tests.v2_0.test_tenants

##manual pep8 test with the wrapper flake8
#source .venv/bin/activate
#flake8 keystoneclient/tests/v2_0/test_tenants.py


OR

5,b)
With tox


* Deactivate virtualenv (Important), then run tox command , otherwise tox command will try to recreate the virtualenv from scratch
#deactivate

*UnitTest
#tox -e py27 -- keystoneclient.tests.v2_0.test_tenants.TenantTests.test_list
#tox -e py27 -- keystoneclient.tests.v2_0.test_tenants
#tox -e py27

*pep8 test
#tox -e pep8 -- keystoneclient.tests.v2_0.test_tenants
#tox -e pep8

http://fosshelp.blogspot.in/2014/11/openstack-unit-testing-tox-runtestssh.html







1 comment:

  1. export OS_USERNAME=admin
    export OS_PASSWORD=secret123
    export OS_TENANT_NAME=demo
    export OS_AUTH_URL=http://127.0.0.1:35357/v2.0

    ReplyDelete