-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AVX-54067: Move plugin changes to Aviatrix managed repo (PR 2/2) (#1)
* move plugin changes to avx managed repo * remove redundant requiremens.txt
- Loading branch information
Showing
23 changed files
with
2,590 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2004-2016 Holger Krekel and others | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
define HELP | ||
|
||
This is the pytest testrail project Makefile. | ||
|
||
Usage: | ||
make clean - Remove generated files | ||
make coverage - Run coverage analysis | ||
make lint - Run static analysis | ||
make release - Bumpversion and push with tags | ||
make requirements - Install dependencies | ||
make test - Run static analysis, tests with coverage | ||
|
||
endef | ||
|
||
export HELP | ||
|
||
all help: | ||
@echo "$$HELP" | ||
|
||
clean: | ||
rm -rf .cache .coverage .tox pytests_py*-test.xml pytest_testrail.egg-info pytest_testrail.txt pytests_coverage.xml | ||
find . -name '*.pyc' -delete | ||
|
||
coverage: | ||
tox -e coverage | ||
|
||
lint: | ||
flake8 pytest_testrail | tee pytest_testrail.txt | ||
|
||
README.rst: README.md | ||
pandoc --from=markdown --to=rst --output=README.rst README.md | ||
|
||
release: | ||
bump2version part $(type) | ||
git push origin master --tags | ||
|
||
requirements: .requirements.txt | ||
|
||
.requirements.txt: requirements/*.txt | ||
pip install -r requirements/base.txt | ||
pip freeze > $@ | ||
|
||
test: coverage lint | ||
tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,109 @@ | ||
# pytest-testrail-plugin | ||
pytest plugin for creating/editing testplans or testruns based on pytest markers | ||
pytest-testrail | ||
=============== | ||
|
||
![](https://github.com/allankp/pytest-testrail/workflows/master/badge.svg) | ||
[![PyPI version](https://badge.fury.io/py/pytest-testrail.svg)](https://badge.fury.io/py/pytest-testrail) | ||
[![Downloads](https://pepy.tech/badge/pytest-testrail)](https://pepy.tech/project/pytest-testrail) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/83b960043527429a8310cced2d8defcb)](https://www.codacy.com/manual/allankp/pytest-testrail?utm_source=github.com&utm_medium=referral&utm_content=allankp/pytest-testrail&utm_campaign=Badge_Grade) | ||
|
||
This is a pytest plugin for creating/editing testplans or testruns based on pytest markers. | ||
The results of the collected tests will be updated against the testplan/testrun in TestRail. | ||
|
||
Installation | ||
------------ | ||
|
||
pip install pytest-testrail | ||
|
||
Configuration | ||
------------- | ||
|
||
### Config for Pytest tests | ||
|
||
Add a marker to the tests that will be picked up to be added to the run. | ||
|
||
```python | ||
from pytest_testrail.plugin import testrail | ||
|
||
@testrail('C1234', 'C5678') | ||
def test_foo(): | ||
# test code goes here | ||
|
||
# OR | ||
|
||
from pytest_testrail.plugin import pytestrail | ||
|
||
@pytestrail.case('C1234', 'C5678') | ||
def test_bar(): | ||
# test code goes here | ||
``` | ||
|
||
Or if you want to add defects to testcase result: | ||
|
||
```python | ||
|
||
from pytest_testrail.plugin import pytestrail | ||
|
||
@pytestrail.defect('PF-524', 'BR-543') | ||
def test_bar(): | ||
# test code goes here | ||
``` | ||
|
||
### Config for TestRail | ||
|
||
* Settings file template config: | ||
|
||
```ini | ||
[API] | ||
url = https://yoururl.testrail.net/ | ||
email = user@email.com | ||
password = <api_key> | ||
|
||
[TESTRUN] | ||
assignedto_id = 1 | ||
project_id = 2 | ||
suite_id = 3 | ||
plan_id = 4 | ||
description = 'This is an example description' | ||
|
||
[TESTCASE] | ||
custom_comment = 'This is a custom comment' | ||
``` | ||
|
||
Or | ||
|
||
* Set command line options (see below) | ||
|
||
Usage | ||
----- | ||
|
||
Basically, the following command will create a testrun in TestRail, add all marked tests to run. | ||
Once the all tests are finished they will be updated in TestRail: | ||
|
||
```bash | ||
py.test --testrail --tr-config=<settings file>.cfg | ||
``` | ||
|
||
### All available options | ||
|
||
| option | description | | ||
| -------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| --testrail | Create and update testruns with TestRail | | ||
| --tr-config | Path to the config file containing information about the TestRail server (defaults to testrail.cfg) | | ||
| --tr-url | TestRail address you use to access TestRail with your web browser (config file: url in API section) | | ||
| --tr-email | Email for the account on the TestRail server (config file: email in API section) | | ||
| --tr-password | Password for the account on the TestRail server (config file: password in API section) | | ||
| --tr-testrun-assignedto-id | ID of the user assigned to the test run (config file:assignedto_id in TESTRUN section) | | ||
| --tr-testrun-project-id | ID of the project the test run is in (config file: project_id in TESTRUN section) | | ||
| --tr-testrun-suite-id | ID of the test suite containing the test cases (config file: suite_id in TESTRUN section) | | ||
| --tr-testrun-suite-include-all | Include all test cases in specified test suite when creating test run (config file: include_all in TESTRUN section) | | ||
| --tr-testrun-name | Name given to testrun, that appears in TestRail (config file: name in TESTRUN section) | | ||
| --tr-testrun-description | Description given to testrun, that appears in TestRail (config file: description in TESTRUN section) | | ||
| --tr-run-id | Identifier of testrun, that appears in TestRail. If provided, option "--tr-testrun-name" will be ignored | | ||
| --tr-plan-id | Identifier of testplan, that appears in TestRail (config file: plan_id in TESTRUN section) If provided, option "--tr-testrun-name" will be ignored | | ||
| --tr-version | Indicate a version in Test Case result. | | ||
| --tr-no-ssl-cert-check | Do not check for valid SSL certificate on TestRail host | | ||
| --tr-close-on-complete | Close a test plan or test run on completion. | | ||
| --tr-dont-publish-blocked | Do not publish results of "blocked" testcases in TestRail | | ||
| --tr-skip-missing | Skip test cases that are not present in testrun | | ||
| --tr-milestone-id | Identifier of milestone to be assigned to run | | ||
| --tc-custom-comment | Custom comment, to be appended to default comment for test case (config file: custom_comment in TESTCASE section) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
pytest-testrail | ||
=============== | ||
|
||
|Build Status| |PyPI version| | ||
|
||
This is a pytest plugin for creating/editing testplans or testruns based | ||
on pytest markers. The results of the collected tests will be updated | ||
against the testplan/testrun in TestRail. | ||
|
||
Installation | ||
------------ | ||
|
||
:: | ||
|
||
pip install pytest-testrail | ||
|
||
Configuration | ||
------------- | ||
|
||
Config for Pytest tests | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Add a marker to the tests that will be picked up to be added to the run. | ||
|
||
.. code:: python | ||
from pytest_testrail.plugin import testrail | ||
@testrail('C1234', 'C5678') | ||
def test_foo(): | ||
# test code goes here | ||
# OR | ||
from pytest_testrail.plugin import pytestrail | ||
@pytestrail.case('C1234', 'C5678') | ||
def test_bar(): | ||
# test code goes here | ||
See a `more detailed example here <tests/livetest/livetest.py>`__. | ||
|
||
Config for TestRail | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
- Settings file template config: | ||
|
||
.. code:: ini | ||
[API] | ||
url = https://yoururl.testrail.net/ | ||
email = user@email.com | ||
password = <api_key> | ||
[TESTRUN] | ||
assignedto_id = 1 | ||
project_id = 2 | ||
suite_id = 3 | ||
Or | ||
|
||
- Set command line options (see below) | ||
|
||
Usage | ||
----- | ||
|
||
Basically, the following command will create a testrun in TestRail, add | ||
all marked tests to run. Once the all tests are finished they will be | ||
updated in TestRail: | ||
|
||
.. code:: bash | ||
py.test --testrail --tr-config=<settings file>.cfg | ||
All available options | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
:: | ||
|
||
--testrail Create and update testruns with TestRail | ||
--tr-config=TR_CONFIG | ||
Path to the config file containing information about | ||
the TestRail server (defaults to testrail.cfg) | ||
--tr-url=TR_URL TestRail address you use to access TestRail with your | ||
web browser (config file: url in API section) | ||
--tr-email=TR_EMAIL Email for the account on the TestRail server (config | ||
file: email in API section) | ||
--tr-password=TR_PASSWORD | ||
Password for the account on the TestRail server | ||
(config file: password in API section) | ||
--tr-testrun-assignedto-id=TR_TESTRUN_ASSIGNEDTO_ID | ||
ID of the user assigned to the test run (config file: | ||
assignedto_id in TESTRUN section) | ||
--tr-testrun-project-id=TR_TESTRUN_PROJECT_ID | ||
ID of the project the test run is in (config file: | ||
project_id in TESTRUN section) | ||
--tr-testrun-suite-id=TR_TESTRUN_SUITE_ID | ||
ID of the test suite containing the test cases (config | ||
file: suite_id in TESTRUN section) | ||
--tr-testrun-suite-include-all | ||
Include all test cases in specified test suite when | ||
creating test run (config file: include_all in TESTRUN | ||
section) | ||
--tr-testrun-name=TR_TESTRUN_NAME | ||
Name given to testrun, that appears in TestRail | ||
(config file: name in TESTRUN section) | ||
--tr-run-id=TR_RUN_ID | ||
Identifier of testrun, that appears in TestRail. If | ||
provided, option "--tr-testrun-name" will be ignored | ||
--tr-plan-id=TR_PLAN_ID | ||
Identifier of testplan, that appears in TestRail. If | ||
provided, option "--tr-testrun-name" will be ignored | ||
--tr-version=TR_VERSION | ||
Indicate a version in Test Case result. | ||
--tr-no-ssl-cert-check | ||
Do not check for valid SSL certificate on TestRail | ||
host | ||
--tr-close-on-complete | ||
Close a test plan or test run on completion. | ||
--tr-dont-publish-blocked | ||
Do not publish results of "blocked" testcases in | ||
TestRail | ||
--tr-skip-missing Skip test cases that are not present in testrun | ||
|
||
.. |Build Status| image:: https://travis-ci.org/allankp/pytest-testrail.svg?branch=master | ||
:target: https://travis-ci.org/allankp/pytest-testrail | ||
.. |PyPI version| image:: https://badge.fury.io/py/pytest-testrail.svg | ||
:target: https://badge.fury.io/py/pytest-testrail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
theme: jekyll-theme-cayman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
pylint $(git ls-files '*.py') --disable=all --enable=error --output-format=parseable > pylint-errors.txt || true | ||
|
||
# Extract files with errors using awk | ||
awk -F: '{print $1}' pylint-errors.txt | sort | uniq > files_with_errors.txt | ||
|
||
# List out all files that failed pylint check | ||
echo "Files that failed pylint check:" | ||
cat files_with_errors.txt | ||
|
||
# Auto-fix line length errors using black and autopep8 | ||
while IFS= read -r file; do | ||
# Apply autopep8 for fixing specific issues | ||
autopep8 --in-place --aggressive --aggressive "$file" | ||
# Apply black for formatting | ||
black "$file" | ||
done < files_with_errors.txt | ||
|
||
# Show diffs of the changes made |
Oops, something went wrong.