From 3d560c1875251f6bf3cf56f848c97388602a77e7 Mon Sep 17 00:00:00 2001 From: netzulo Date: Tue, 3 Jul 2018 23:37:33 +0200 Subject: [PATCH 1/5] [tl-tests] initial commit , refactor project to python language --- .gitignore | 112 +++++++++++++++++++++++ .travis.yml | 36 ++++++++ README.rst | 101 +++++++++++++++++++++ USAGE.rst | 142 ++++++++++++++++++++++++++++++ setup.cfg | 5 ++ setup.py | 89 +++++++++++++++++++ testlinktests/__init__.py | 13 +++ testlinktests/configs/__init__.py | 10 +++ testlinktests/core/__init__.py | 13 +++ testlinktests/core/utils.py | 64 ++++++++++++++ tox.ini | 72 +++++++++++++++ 11 files changed, 657 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 README.rst create mode 100644 USAGE.rst create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 testlinktests/__init__.py create mode 100644 testlinktests/configs/__init__.py create mode 100644 testlinktests/core/__init__.py create mode 100644 testlinktests/core/utils.py create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e976fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,112 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# Sonar +.sonar/ + +# TESTLINKTESTS ignores +testlinktests/configs/settings.json +tests/reports/* +tests/reports/coverage/* +tests/reports/benchmarks/benchmark.*.svg +# Visual Studio +.vs/ +# Visual code +.vscode/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0122c8c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,36 @@ +env: + global: +# GITHUB_TOKEN + - secure: LYqe4kN1i8BqVEAO8fdO+CYrx9z8h1ab+NxCgYubLcP70DZoKNRj1/egULOd3uvDHFigFVeaACRR6vUQnHbHsffSkMr4nqwOeJMbxOdspHPuA4oMUy5RZKRC7P+v6Dlwpg4Psg/VsEnP6lHWb/RbosBE8tU8ukewD14EU3o29Ql+lBfvvOW/81UTGokMQa1zrW9o70oEaTYqePT9YzM9UcKgukshYtcxKE3oiwLm3fB8zBAUJwzkEvBGNpXjqBEDCUjrS80CqgY3BRsPfnPk90LgjeORaZKoP1f/bZE4UtgeESK0xpWsKEcDCRkSfGxYw8rD7nwc6H5LiCeoS87oQpUCMsoijmGL1yLrBBMIRAWoMC/o+h/QI5bb+IyLba6KLihY4LpExnWj2V8Mh6qs6AeV8v/Dl1WdyIi72WIkMBrmVrOhtoJJ45QaZJbrwSMeM4/ShS5NdiLFnGKeYOjMJ+DQZa+//SIwnvsOegm918TmOZqCr2YabI6WYixOzYjQPvI2KliZGekaX9uSNxVwoWZDE8jvdhvBWtHsL6hMqAv5ehEJw1aseLwjEGHQjIY0YBqJI38QmFr0vro6/9U2EehXHeW3ycCrPguQJ50nIK/DwiGMadUhrxU0xfZ6+TfFpGY0RivEPLD+Cup9C5oVFAppPJncdBdXUqouR90/8NI= +addons: + sonarqube: + branches: + - master +language: python +matrix: + include: + - os: linux + sudo;: required + python: 2.7 + env: TOXENV=py27 + - os: linux + sudo;: required + python: 3.4 + env: TOXENV=py34 + - os: linux + sudo;: required + python: 3.5 + env: TOXENV=py35 + - os: linux + sudo;: required + python: 3.6 + env: TOXENV=py36 + +before_install: +- pip freeze +install: +- pip install tox +script: +- tox -e "{$TOXENV},flake8" +after_script: +- python setup.py sdist \ No newline at end of file diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..de11e78 --- /dev/null +++ b/README.rst @@ -0,0 +1,101 @@ +Testlink-tests +============== + + +.. image:: https://img.shields.io/github/issues/TestLinkOpenSourceTRMS/testlink-tests.svg + :alt: Issues on Github + :target: https://github.com/TestLinkOpenSourceTRMS/testlink-tests/issues + +.. image:: https://img.shields.io/github/issues-pr/TestLinkOpenSourceTRMS/testlink-tests.svg + :alt: Pull Request opened on Github + :target: https://github.com/TestLinkOpenSourceTRMS/testlink-tests/issues + +.. image:: https://img.shields.io/github/release/TestLinkOpenSourceTRMS/testlink-tests.svg + :alt: Release version on Github + :target: https://github.com/TestLinkOpenSourceTRMS/testlink-tests/releases/latest + +.. image:: https://img.shields.io/github/release-date/TestLinkOpenSourceTRMS/testlink-tests.svg + :alt: Release date on Github + :target: https://github.com/TestLinkOpenSourceTRMS/testlink-tests/releases/latest + + ++-----------------------+-----------------------+--------------------------+--------------------------+------------------------------+ +| Branch | TravisCI | Appveyor | CircleCi - Docker | CodeClimate | ++=======================+=======================+==========================+==========================+==============================+ +| master | |master_ci_travis| | |master_ci_appveyor| | |master_ci_circleci| | |master_ci_codeclimate| | ++-----------------------+-----------------------+--------------------------+--------------------------+------------------------------+ + + +Python tested versions +---------------------- + ++-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+ +| **3.6** | **3.5** | **3.4** | **3.3** | **3.2** | **2.7** | ++===================+===================+===================+===================+===================+===================+ +| *Supported* | *Supported* | *Supported* | *Not Supported* | *Not Supported* | *Supported* | ++-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+ + + +Prerequisites +------------- + ++ Prerequisites : ``TODO: make sense`` + + +How to install ? +---------------- + ++ Install from PIP : ``pip install testlink-tests`` + ++ Install from setup.py file : ``python setup.py install`` + + + +How to exec tests ? +------------------- + ++ Tests from setup.py file : ``python setup.py test`` + ++ Install from PIP file : ``pip install tox`` ++ Tests from tox : ``tox -l && tox -e TOX_ENV_NAME`` ( *see tox.ini file to get environment names* ) + + ++---------------------+--------------------------------+ +| TOX Env name | Env description | ++=====================+================================+ +| py27,py34,py35,py36 | Python supported versions | ++---------------------+--------------------------------+ +| flake8 | Exec linter in qalab/ tests/ | ++---------------------+--------------------------------+ +| coverage | Generate XML and HTML reports | ++---------------------+--------------------------------+ +| docs | Generate doc HTML in /docs | ++---------------------+--------------------------------+ + +Configuration File +~~~~~~~~~~~~~~~~~~ + + +:: + + { + "connection":{ + "is_https": false, + "host": "qalab.tk", + "port": 86 + }, + "dev_key": "1bfd2ef4ceda22b482b12f2b25457495", + "log_level":"DEBUG", + } + +Getting Started +~~~~~~~~~~~~~~~ + +*Just starting example of usage before read* `Usage Guide`_. + + +.. _Usage Guide: USAGE.rst +.. |master_ci_travis| image:: http://demo.testlink.org +.. |master_ci_appveyor| image:: http://demo.testlink.org +.. |master_ci_circleci| image:: http://demo.testlink.org +.. |master_ci_codeclimate| image:: http://demo.testlink.org diff --git a/USAGE.rst b/USAGE.rst new file mode 100644 index 0000000..15f7a9a --- /dev/null +++ b/USAGE.rst @@ -0,0 +1,142 @@ +Usage Guide +=========== + +Usage ( *XMLRPC* ) +****************** + ++ 1. Create JSON configuration ( runtime or read from file, *read config section* ) ++ 2. Instance **testlink_manager** object ``testlink_manager = TLManager(settings=my_json_config)`` ++ 3. Use some *method name with prefix* '**api_**' + +**api_login** ++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.checkDevKey*' +* **Description** : check if dev_key it's valid + +**api_tprojects** ++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getProjects*' +* **Description** : get all test projects + + +**api_tproject** +++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getTestProjectByName*' +* **Description** : get one test project filtered by name + +**api_tproject_tplans** ++++++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getProjectTestPlans*' +* **Description** : get all test plans for one test project + +**api_tproject_tsuites_first_level** +++++++++++++++++++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getFirstLevelTestSuitesForTestProject*' +* **Description** : get all test suites on first level for one test project + +**api_tplan** ++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getTestPlanByName*' +* **Description** : get one test plan filtered by project and plan names + +**api_tplan_platforms** ++++++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getTestPlanPlatforms*' +* **Description** : get one test plan filtered by project and plan names + +**api_tplan_builds** +++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getBuildsForTestPlan*' +* **Description** : get all builds for test project filtered by id + +**api_tplan_tsuites** ++++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getTestSuitesForTestPlan*' +* **Description** : get all test suites assigned to test plan filtered by id + +**api_tplan_tcases** +++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getTestCasesForTestPlan*' +* **Description** : get all test cases assigned to test plan filtered by id + +**api_tplan_build_latest** +++++++++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getLatestBuildForTestPlan*' +* **Description** : get latest build by choosing the maximum build id for a specific test plan id + +**api_tplan_totals** +++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getTotalsForTestPlan*' +* **Description** : get totals for testplan filtered by id + +**api_tsuite** +++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getTestSuiteByID*' +* **Description** : get test suite filtered by id + +**api_tsuite_tsuites** +++++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getTestSuitesForTestSuite*' +* **Description** : get test suites down of tree for one test suite filtered by id + +**api_tcase** ++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getTestCase*' +* **Description** : get test case filtered by id or external id + +**api_tcase_by_name** ++++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.getTestCaseIDByName*' +* **Description** : get test case filtered by name + +**api_tcase_report** +++++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.reportTCResult*' +* **Description** : reports a result for a single test case + +**api_user_exist** +++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.doesUserExist*' +* **Description** : check if user name it's valid + +**api_about** ++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.about*' +* **Description** : get default message with author and testlink version + +**api_say_hello** ++++++++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.sayHello*' +* **Description** : get **'Hello!'** message + +**api_ping** +++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.ping*' +* **Description** : get **'Hello!'** message + +**api_ping** +++++++++++++ + +* **XMLRPC**: *call to method named* '*tl.repeat*' +* **Description** : get **You said: 'your message here'** as message diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..4f9c1cb --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[metadata] +description-file = README.rst + +[aliases] +test=pytest diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..9f3e3c8 --- /dev/null +++ b/setup.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# pylint: disable=broad-except +"""qatestlink module can be installed and configured from here""" + +from os import path +from setuptools import setup, find_packages +from testlinktests.core.utils import read_file +from testlinktests.core.utils import path_format + + +VERSION = '0.0.0' +CURR_PATH = "{}{}".format(path.abspath(path.dirname(__file__)), '/') + + +def read(file_name=None, is_encoding=True, ignore_raises=False): + """Read file""" + if file_name is None: + raise Exception("File name not provided") + if ignore_raises: + try: + return read_file(is_encoding=is_encoding, + file_path=path_format( + file_path=CURR_PATH, + file_name=file_name, + ignore_raises=ignore_raises)) + except Exception: + # TODO: not silence like this, + # must be on setup.cfg, README path + return 'NOTFOUND' + return read_file(is_encoding=is_encoding, + file_path=path_format( + file_path=CURR_PATH, + file_name=file_name, + ignore_raises=ignore_raises)) + + +setup( + name='testlinktests', + version=VERSION, + license=read("LICENSE", is_encoding=False, ignore_raises=True), + packages=find_packages(exclude=['tests']), + description='Main automation lib to ensure behaviour of Testlink WebApp', + long_description=read("README.rst"), + author='TestLinkOpenSourceTRMS', + author_email='netzuleando@gmail.com', # Can be replaced + url='https://github.com/TestLinkOpenSourceTRMS/testlink-tests', + download_url=("https://github.com/TestLinkOpenSourceTRMS" + "/testlink-tests/tarball/v{}").format(VERSION), + keywords=[ + 'testing', + 'logging', + 'functional', + 'http', + 'test', + 'testlink', + 'XMLRPC', + 'requests', + 'webapp', + 'selenium', + 'functional' + ], + install_requires=[ + 'qatestlink' + ], + setup_requires=[ + 'tox', + 'pytest-runner', + ], + tests_require=[ + 'pytest', + 'pytest-html', + 'pytest-dependency', + 'pytest-benchmark', + 'pytest-benchmark[histogram]', + 'coverage==4.3.4', + 'pytest-cov==2.5.0', + 'flake8' + ], + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Topic :: Software Development :: Build Tools', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', + ], +) \ No newline at end of file diff --git a/testlinktests/__init__.py b/testlinktests/__init__.py new file mode 100644 index 0000000..7717837 --- /dev/null +++ b/testlinktests/__init__.py @@ -0,0 +1,13 @@ + +# -*- coding: utf-8 -*- +"""package testlinktests + Created on 2018-07-03 + + @author: netzulo +""" + + +from testlinktests import configs +from testlinktests import core + +__all__ = ['configs', 'core'] diff --git a/testlinktests/configs/__init__.py b/testlinktests/configs/__init__.py new file mode 100644 index 0000000..5859960 --- /dev/null +++ b/testlinktests/configs/__init__.py @@ -0,0 +1,10 @@ + +# -*- coding: utf-8 -*- +"""package testlinktests.configs + Created on 2018-07-03 + + @author: netzulo +""" + + +__all__ = [] diff --git a/testlinktests/core/__init__.py b/testlinktests/core/__init__.py new file mode 100644 index 0000000..cf81b99 --- /dev/null +++ b/testlinktests/core/__init__.py @@ -0,0 +1,13 @@ + +# -*- coding: utf-8 -*- +"""package testlinktests.core + Created on 2018-07-03 + + @author: netzulo +""" + + +from testlinktests.core import utils + + +__all__ = ['utils'] diff --git a/testlinktests/core/utils.py b/testlinktests/core/utils.py new file mode 100644 index 0000000..190e75e --- /dev/null +++ b/testlinktests/core/utils.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +"""Utils tasks for files operations and settings operations""" + + +import json +from os import path +from sys import version_info + + +def path_format(file_path=None, file_name=None, is_abspath=False, + ignore_raises=False): + """ + Get path joined checking before if path and filepath exist, + if not, raise an Exception + if ignore_raise it's enabled, then file_path must include '/' at end lane + """ + path_formatted = "{}{}".format(file_path, file_name) + if ignore_raises: + return path_formatted + if file_path is None or not path.exists(file_path): + raise IOError("Path '{}' doesn't exists".format(file_path)) + if file_name is None or not path.exists(path_formatted): + raise IOError( + "File '{}{}' doesn't exists".format(file_path, file_name)) + if is_abspath: + return path.abspath(path.join(file_path, file_name)) + else: + return path.join(file_path, file_name) + + +def read_file(is_json=False, file_path=None, encoding='utf-8', + is_encoding=True): + """Returns file object from file_path, + compatible with all py versiones + optionals: + can be use to return dict from json path + can modify encoding used to obtain file + """ + text = None + if file_path is None: + raise Exception("File path received it's None") + if version_info.major >= 3: + if not is_encoding: + encoding = None + with open(file_path, encoding=encoding) as buff: + text = buff.read() + if version_info.major <= 2: + with open(file_path) as buff: + if is_encoding: + text = buff.read().decode(encoding) + else: + text = buff.read() + if is_json: + return json.loads(text) + return text + + +def settings(file_path='./', file_name='settings.json', + is_abspath=True): + """Returns file settings as a dict to be use on qacode lib""" + return read_file(is_json=True, + file_path=path_format(file_path=file_path, + file_name=file_name, + is_abspath=is_abspath)) \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..4626964 --- /dev/null +++ b/tox.ini @@ -0,0 +1,72 @@ +[tox] +envlist = py27,py34,py35,py36,flake8,docs +[testenv:py27] +commands = python setup.py test +deps = + qautils +[testenv:py34] +commands = python setup.py test +deps = + qautils +[testenv:py35] +commands = python setup.py test +deps = + qautils +[testenv:py36] +commands = python setup.py test +deps = + qautils +[docs] +skip_install = true +commands = cd docs && make clean && make html +deps = + Sphinx + +[testenv:flake8] +skip_install = true +max-complexity = 10 +commands = flake8 --ignore=D400,D205,I201,N812,D401,D413,D208 testlink-tests/ tests/ +deps = + qautils + flake8 + flake8-docstrings>=0.2.7 + flake8-import-order>=0.9 + pep8-naming + flake8-colors +exclude = + .git, + __pycache__, + docs/source/conf.py, + old, + build, + dist, + logs, + .vscode, + .eggs, + .cache + +[testenv:coverage] +description = Environment to generate coverage reports +commands = + py.test --self-contained-html --cov=testlink-tests tests/ --cov-report html:tests/reports/coverage/ --cov-report xml:tests/reports/coverage.xml +deps = + qautils + pytest + pytest-html + pytest-dependency + coverage==4.3.4 + pytest-cov==2.5.0 + pytest-benchmark + pytest-benchmark[histogram] + +exclude = + .git, + __pycache__, + docs/source/conf.py, + old, + build, + dist, + logs, + .vscode, + .eggs, + .cache \ No newline at end of file From 63446a9b1523cbd7b26f49be14d4d04fa65b9a98 Mon Sep 17 00:00:00 2001 From: netzulo Date: Wed, 4 Jul 2018 01:49:22 +0200 Subject: [PATCH 2/5] [tl-tests] added pytest conf --- README.rst | 2 +- pytest.ini | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 pytest.ini diff --git a/README.rst b/README.rst index de11e78..1cac880 100644 --- a/README.rst +++ b/README.rst @@ -45,7 +45,7 @@ Prerequisites How to install ? ---------------- -+ Install from PIP : ``pip install testlink-tests`` ++ Install from PIP : ``pip install testlinktests`` + Install from setup.py file : ``python setup.py install`` diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..c3ac677 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,15 @@ +[pytest] +addopts = + --verbose + --junit-xml=tests/reports/test_coverage.xml + --html=tests/reports/test_coverage.html + --self-contained-html + --cov=testlinktests tests/ + --cov-report html:tests/reports/coverage/ + --cov-report xml:tests/reports/coverage.xml + --benchmark-histogram=tests/reports/benchmarks/benchmark.svg +testpaths = tests +console_output_style = progress +python_files = suite_*_*.py +python_classes = Test* +python_functions = test_*_* \ No newline at end of file From 76ab75a5998cc24764c96d40ff1fd06c73780db1 Mon Sep 17 00:00:00 2001 From: netzulo Date: Wed, 4 Jul 2018 01:56:36 +0200 Subject: [PATCH 3/5] [tl-tests] temporal badges url --- README.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 1cac880..9839b8b 100644 --- a/README.rst +++ b/README.rst @@ -95,7 +95,9 @@ Getting Started .. _Usage Guide: USAGE.rst -.. |master_ci_travis| image:: http://demo.testlink.org -.. |master_ci_appveyor| image:: http://demo.testlink.org +.. |master_ci_travis| image:: https://travis-ci.org/netzulo/testlink-tests.svg?branch=master + :target: https://travis-ci.org/netzulo/testlink-tests +.. |master_ci_appveyor| image:: https://ci.appveyor.com/api/projects/status/8kqf9o9mjgvte40j?svg=true + :target: https://ci.appveyor.com/project/netzulo/testlink-tests .. |master_ci_circleci| image:: http://demo.testlink.org .. |master_ci_codeclimate| image:: http://demo.testlink.org From c9e6c115772d89a48175ef13954bba0211fecabf Mon Sep 17 00:00:00 2001 From: netzulo Date: Wed, 4 Jul 2018 01:57:45 +0200 Subject: [PATCH 4/5] [tl-test] add CI, appveyor --- appveyor.yml | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..e7b03c1 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,65 @@ +build: off +branches: + only: + - master +environment: + global: + # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the + # /E:ON and /V:ON options are not enabled in the batch script intepreter + # See: http://stackoverflow.com/a/13751649/163740 + CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" + + matrix: + - JOB: "2.7 32-bit" + TOXENV: "py27" + PYTHON: "C:\\Python27.10" + PYTHON_VERSION: "2.7.10" + PYTHON_ARCH: "32" + - JOB: "2.7 64-bit" + TOXENV: "py27" + PYTHON: "C:\\Python27.10-x64" + PYTHON_VERSION: "2.7.10" + PYTHON_ARCH: "64" + + - JOB: "3.4 64-bit" + TOXENV: "py34" + PYTHON: "C:\\Python34-x64" + PYTHON_VERSION: "3.4" + PYTHON_ARCH: "64" + + - JOB: "3.5 64-bit" + TOXENV: "py35" + PYTHON: "C:\\Python35-x64" + PYTHON_VERSION: "3.5.0" + PYTHON_ARCH: "64" + + - JOB: "3.6 64-bit" + TOXENV: "py36" + PYTHON: "C:\\Python36" + PYTHON_VERSION: "3.6.3" + PYTHON_ARCH: "64" + +install: + # Prepend newly installed Python to the PATH of this build (this cannot be + # done from inside the powershell script as it would require to restart + # the parent CMD process). + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + # Check that we have the expected version and architecture for Python + - "python --version" + - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + # Upgrade to the latest version of pip to avoid it displaying warnings + # about it being out of date. + - "python -m pip install wheel" + - "python -m pip install --pre -U tox" + - "pip install qautils" + - "python setup.py clean" + - "python setup.py build" + +test_script: + - "tox -e %TOXENV%,flake8" + +after_test: + - "python setup.py sdist" + +artifacts: +- path: "dist\\*" \ No newline at end of file From fa4a942d365a4aa5e894f84aa3fe1492bdac36d0 Mon Sep 17 00:00:00 2001 From: netzulo Date: Wed, 4 Jul 2018 02:13:47 +0200 Subject: [PATCH 5/5] [tl-tests] add CIs, codeclimate+appveyor --- .circleci/config.yml | 49 ++++++++++++++++++++++++++++++++++++++++++++ README.rst | 6 ++++-- 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..33615c9 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,49 @@ +# Python CircleCI 2.0 configuration file +version: 2 +jobs: + build: + environment: + CC_TEST_REPORTER_ID: 181a274c2c68483ff80af63a8a87e1f5fab71f37744eab702f25695501b5ca85 + docker: + - image: circleci/python:3.6.1 + + working_directory: ~/repo + + steps: + - checkout + - run: + name: Install dependencies + command: | + # CI, CircleCI dependencies + python3 -m venv venv + . venv/bin/activate + # CI, codeclimate dependencies + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + pip install codeclimate-test-reporter + # project dependencies + pip install tox + pip install coverage==4.2 + - run: + name: Install project + command: | + . venv/bin/activate + python setup.py install + - run: + name: Before Tests + command: | + ./cc-test-reporter before-build + - run: + name: Run Tests + command: | + . venv/bin/activate + tox -e coverage,flake8 + - run: + name: After Tests + command: | + . venv/bin/activate + ls -ltra tests/reports/ + codeclimate-test-reporter --token $CC_TEST_REPORTER_ID --file .coverage + - store_artifacts: + path: dist + destination: dist \ No newline at end of file diff --git a/README.rst b/README.rst index 9839b8b..90954f7 100644 --- a/README.rst +++ b/README.rst @@ -99,5 +99,7 @@ Getting Started :target: https://travis-ci.org/netzulo/testlink-tests .. |master_ci_appveyor| image:: https://ci.appveyor.com/api/projects/status/8kqf9o9mjgvte40j?svg=true :target: https://ci.appveyor.com/project/netzulo/testlink-tests -.. |master_ci_circleci| image:: http://demo.testlink.org -.. |master_ci_codeclimate| image:: http://demo.testlink.org +.. |master_ci_circleci| image:: https://circleci.com/gh/netzulo/testlink-tests.svg?style=svg + :target: https://circleci.com/gh/netzulo/testlink-tests) +.. |master_ci_codeclimate| image:: https://api.codeclimate.com/v1/badges/84904556cd07ad4fcf00/maintainability + :target: https://codeclimate.com/github/netzulo/testlink-tests/maintainability