# End of https://www.gitignore.io/api/node,sonar,maven,eclipse,sonarqube,intellij+all
-.flattened-pom.xml
\ No newline at end of file
+.flattened-pom.xml
+.venv
+venv
--- /dev/null
+Python Testing Utils
+=======================
+
+Robot Framework library and utilities for ONAP end-to-end testing.
+
+Project Structure
+-----------------
+- robotframework-onap/ - Main Robot Framework library package
+ - ONAPLibrary/ - Robot keywords for ONAP components (AAI, SDC, SO, etc.)
+ - vcpeutils/ - vCPE-specific utilities
+ - tests/ - Unit tests
+
+Quick Start
+-----------
+
+1. Create and activate a virtual environment:
+
+```bash
+python3 -m venv .venv
+source .venv/bin/activate
+```
+
+2. Install the package in development mode:
+
+```bash
+cd robotframework-onap
+pip install -e .
+pip install -r test-requirements.txt
+```
+
+3. Run tests:
+
+```bash
+pytest tests/ -v
+```
+
+4. Run linting:
+
+```bash
+tox -e pep8
+tox -e pylint
+```
+
+Using tox
+---------
+Run all checks (tests, pep8, pylint):
+
+```bash
+cd robotframework-onap
+tox
+```
+
+Run specific target:
+
+```bash
+tox -e py3 # Run tests with coverage
+tox -e pep8 # Run flake8 linting
+tox -e pylint # Run pylint
+```
+
+Requirements
+------------
+- Python 3.7+
from hashlib import md5
from paramiko import RSAKey
from paramiko.ssh_exception import PasswordRequiredException
-from six import string_types
from ONAPLibrary.Utilities import Utilities
def get_yaml(self, template_file):
"""Template Yaml To Json reads a YAML Heat template file returns a JSON string that can be used included
in an Openstack Add Stack Request"""
- if isinstance(template_file, string_types):
- fin = open(template_file, 'r')
- yamlobj = yaml.load(fin)
+ if isinstance(template_file, str):
+ with open(template_file, 'r') as fin:
+ yamlobj = yaml.safe_load(fin)
return yamlobj
return None
"""Template Yaml To Json reads a YAML Heat template file returns a JSON string that can be used included
in an Openstack Add Stack Request"""
contents = None
- if isinstance(template_file, string_types):
- fin = open(template_file, 'r')
- yamlobj = yaml.load(fin)
- fin.close()
+ if isinstance(template_file, str):
+ with open(template_file, 'r') as fin:
+ yamlobj = yaml.safe_load(fin)
if 'heat_template_version' in yamlobj:
datetime = yamlobj['heat_template_version']
yamlobj['heat_template_version'] = str(datetime)
- fout = io.BytesIO()
+ fout = io.StringIO()
json.dump(yamlobj, fout)
contents = fout.getvalue()
fout.close()
def env_yaml_to_json(self, template_file):
"""Env Yaml To JSon reads a YAML Heat env file and returns a JSON string that can be used included
in an Openstack Add Stack Request"""
- if isinstance(template_file, string_types):
- fin = open(template_file, 'r')
- yamlobj = yaml.load(fin)
- fin.close()
+ if isinstance(template_file, str):
+ with open(template_file, 'r') as fin:
+ yamlobj = yaml.safe_load(fin)
if 'parameters' in yamlobj:
- fout = io.BytesIO()
+ fout = io.StringIO()
json.dump(yamlobj['parameters'], fout)
contents = fout.getvalue()
fout.close()
# See the License for the specific language governing permissions and
# limitations under the License.
-from six.moves import urllib
+from urllib import parse as urlparse
from robot.api.deco import keyword
import urllib3
@keyword
def url_encode_string(self, barestring):
"""URL Encode String takes in a string and converts it into fully 'percent-encoded' string"""
- return urllib.parse.quote(barestring)
+ return urlparse.quote(barestring)
@keyword
def url_parse(self, url):
""" Get pieces of the URL """
- return urllib.parse.urlparse(url)
+ return urlparse.urlparse(url)
@keyword
def disable_warnings(self):
import json
from robot.api.deco import keyword
from deepdiff import DeepDiff
-from six import string_types
class JSONKeywords(object):
def _json_compare(self, left, right, cmp):
"""_json_compare takes two strings or JSON objects and checks their DeepDiff using cmp function."""
- if isinstance(left, string_types):
+ if isinstance(left, str):
left_json = json.loads(left)
else:
left_json = left
- if isinstance(right, string_types):
+ if isinstance(right, str):
right_json = json.loads(right)
else:
right_json = right
# limitations under the License.
import json
-from six import string_types
from robot.api.deco import keyword
from jsonpath_rw import parse
which is converted into string if needed and then compares them, returning the matches."""
jsonpath_expr = parse(expression)
- if isinstance(target, string_types):
+ if isinstance(target, str):
search_json = json.dumps(target)
else:
search_json = target
--- /dev/null
+Robotframework-ONAP
+=======================
+
+Robot Framework library for ONAP testing.
+
+Packages
+--------
+- ONAPLibrary - Robot keywords for ONAP components (AAI, SDC, SO, SDNC, etc.)
+- vcpeutils - vCPE service orchestration utilities
+
+Installation
+------------
+
+```bash
+pip install -e .
+```
+
+Development Setup
+-----------------
+
+1. Create virtual environment (from repo root):
+
+```bash
+python3 -m venv .venv
+source .venv/bin/activate
+```
+
+2. Install in development mode with test dependencies:
+
+```bash
+pip install -e .
+pip install -r test-requirements.txt
+```
+
+3. Run tests:
+
+```bash
+pytest tests/ -v
+```
+
+Or with coverage:
+
+```bash
+pytest tests/ --cov=ONAPLibrary --cov=vcpeutils --cov-report=html
+```
+
+Using tox
+---------
+Available targets:
+
+- py3: Run unit tests with coverage
+- pep8: Python linting with flake8
+- pylint: Python linting with pylint
+
+Run all targets:
+
+```bash
+tox
+```
+
+Run specific target:
+
+```bash
+tox -e py3
+tox -e pep8
+tox -e pylint
+```
+
+Requirements
+------------
+- Python 3.7+
+- See requirements.txt for dependencies
pbr
deepdiff
dnspython
-future
jinja2
jsonpath-rw
kafka-python
protobuf
pyyaml
requests
-robotframework-requests==0.9.3
+robotframework-requests>=0.9.6
robotlibcore-temp
-six
urllib3
more-itertools
name = robotframework-onap
author = Daniel Rose
author_email = dr695h@att.com
-version = 11.0.0
+version = 11.0.1
home-page = https://github.com/onap/testsuite-python-testing-utils
classifier =
Development Status :: 4 - Beta
[options]
python_requires = >=3.7
+[tool:pytest]
+testpaths = tests
+python_files = *Test.py *Tests.py *_test.py test_*.py
+python_classes = *Test *Tests Test*
+python_functions = test_* test
+
[files]
packages =
vcpeutils
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-coverage!=4.4,>=4.0 # Apache-2.0
-mock>=2.0 # BSD
-nose # LGPL
+coverage>=4.0 # Apache-2.0
+pytest>=7.0.0
+pytest-cov
flake8 # MIT
pylint # GPLv2
requests
requests-mock
-more-itertools~=5.0.0
+more-itertools
[tox]
envlist = pep8,pylint,py3
distdir = {toxinidir}/dist
-modules =
- ONAPLibrary
- vcpeutils
[testenv]
deps =
install_command = pip install {opts} {packages}
[testenv:pep8]
-basepython = python3.8
+basepython = python3
changedir = {toxinidir}
commands =
- flake8 --max-line-length 120 {[tox]modules}
+ flake8 --max-line-length 120 ONAPLibrary vcpeutils
[testenv:pylint]
-basepython = python3.8
+basepython = python3
deps =
pyflakes
pylint
commands =
- pylint -f parseable --ignore-imports=y --disable=locally-disabled --max-line-length 120 --exit-zero -ry {[tox]modules}
+ pylint -f parseable --ignore-imports=y --disable=locally-disabled --max-line-length 120 --exit-zero -ry ONAPLibrary vcpeutils
[testenv:py3]
-basepython = python3.8
-commands = nosetests --with-xunit \
- --all-modules \
- --with-coverage \
- --cover-tests \
- --cover-package=ONAPLibrary,vcpeutils \
- --cover-xml \
- --cover-html \
- tests
+basepython = python3
+commands = pytest tests/ \
+ --junitxml=test-results.xml \
+ --cov=ONAPLibrary \
+ --cov=vcpeutils \
+ --cov-report=xml \
+ --cov-report=html
major=11
minor=0
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}