VOL-2642 Add a Makefile, tests, and virtualenv
Convert common python and robot into a CORDRobot python module that can
be installed via standard python tools (pip) and from PyPI
Uses a fork of https://github.com/rasjani/robotframework-importresource,
which has been backported to Python 3.5 (used in Ubuntu 16.04
executors).
Reformatted and moved keywords so resource files are scoped to a
specific topic.
Added tox tests for library consistency
- flake8
- pylint
- robotframework-lint
- Ran robot against installed library to verify it can be loaded and
used
Added basic lint and tests to whole repo
Removed old tests:
- CORD <6.x era: SanityPhyPOD.robot, and onosUtils.py
Change-Id: I61265a9fb04034a086e20be1f7236a8793a218aa
diff --git a/cord-robot/setup.py b/cord-robot/setup.py
new file mode 100644
index 0000000..ce710d9
--- /dev/null
+++ b/cord-robot/setup.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+# Copyright 2020-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+from setuptools import setup
+from shutil import copyfile
+
+LIBRARY_NAME = "CORDRobot"
+
+
+def version():
+ # Copy VERSION file of parent to module directory if not found
+ version_path = os.path.join(LIBRARY_NAME, "VERSION")
+ if not os.path.exists(version_path):
+ copyfile("../VERSION", version_path)
+ with open(version_path) as f:
+ return f.read().strip()
+
+
+def parse_requirements(filename):
+ # parse a requirements.txt file, allowing for blank lines and comments
+ requirements = []
+ for line in open(filename):
+ if line and not line.startswith("#"):
+ requirements.append(line)
+ return requirements
+
+
+setup(
+ name="cord-robot",
+ version=version(),
+ description="CORD Project Robot Libraries and common Resources",
+ author="CORD Developers",
+ include_package_data=True,
+ packages=[LIBRARY_NAME],
+ package_data={
+ LIBRARY_NAME: ["rf-resources/*.resource", "VERSION"]
+ },
+ install_requires=parse_requirements("requirements.txt"),
+)