-
Notifications
You must be signed in to change notification settings - Fork 11
Dependencies update #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e546719
Drop Python 3.7 support, add Python 3.13 support, update client version
HardNorth 2cdbb9f
Client version update
HardNorth ea21736
Apply black and isort formats
HardNorth 64e50b0
Gitignore update
HardNorth b812a7f
End of fileFix line ending
HardNorth daa649a
Format fix
HardNorth 9bbdc87
Ignore a flake rule
HardNorth b409830
Update setup.py
HardNorth 179d9d2
Convert README.rst to README.md
HardNorth 851847b
README.md update
HardNorth 4aca05a
Update release.yml
HardNorth d8afc48
Update behave version
HardNorth e4500b5
Fix typing
HardNorth 54132f0
Update types
HardNorth a449d1e
Update CHANGELOG.md
HardNorth 96348fd
Fix some warnings
HardNorth 2189dfd
Fix warnings
HardNorth 7784da7
Correct inclusions
HardNorth cc272da
Fix some misspellings
HardNorth 3ddc700
Add another rule ignore
HardNorth 5453d8d
Add venv exclusion
HardNorth b36ebf3
Limit upper bound of behave
HardNorth 8decbfc
Fix review comments
HardNorth 022efcc
Fix review comments
HardNorth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,4 @@ | ||
| [flake8] | ||
| ignore = E203, W503 | ||
| max-line-length = 119 | ||
| exclude = .git,venv,env,.venv,.venv38,.venv310 |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -107,6 +107,7 @@ celerybeat.pid | |
| .venv | ||
| env/ | ||
| venv/ | ||
| .venv3*/ | ||
| ENV/ | ||
| env.bak/ | ||
| venv.bak/ | ||
|
|
||
This file contains hidden or 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,27 +1,32 @@ | ||
| # See https://pre-commit.com for more information | ||
| # See https://pre-commit.com/hooks.html for more hooks | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v3.4.0 | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: trailing-whitespace | ||
| - id: end-of-file-fixer | ||
| - id: check-yaml | ||
| - id: check-added-large-files | ||
| - repo: https://github.com/PyCQA/pydocstyle | ||
| rev: 6.0.0 | ||
| - id: trailing-whitespace | ||
| - id: end-of-file-fixer | ||
| - id: check-yaml | ||
| - id: check-added-large-files | ||
| - repo: https://github.com/PyCQA/pydocstyle | ||
| rev: 6.3.0 | ||
| hooks: | ||
| - id: pydocstyle | ||
| - id: pydocstyle | ||
| exclude: | | ||
| (?x)^( | ||
| tests/.* | | ||
| examples/.* | ||
| ) | ||
| - repo: https://github.com/Lucas-C/pre-commit-hooks-markup | ||
| rev: v1.0.1 | ||
| (?x)^( | ||
| tests/.* | | ||
| examples/.* | ||
| ) | ||
| - repo: https://github.com/psf/black | ||
| rev: 24.10.0 | ||
| hooks: | ||
| - id: black | ||
| args: [ '--check' ] | ||
| - repo: https://github.com/pycqa/isort | ||
| rev: 6.0.0 | ||
| hooks: | ||
| - id: rst-linter | ||
| - repo: https://github.com/pycqa/flake8 | ||
| rev: 5.0.4 | ||
| - id: isort | ||
| - repo: https://github.com/pycqa/flake8 | ||
| rev: 7.1.1 | ||
| hooks: | ||
| - id: flake8 | ||
| - id: flake8 |
This file contains hidden or 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
This file contains hidden or 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 @@ | ||
| include MANIFEST.in | ||
| include README.rst requirements.txt | ||
| include LICENSE README.md CHANGELOG.md requirements.txt |
This file contains hidden or 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,189 @@ | ||
| # agent-python-behave | ||
|
|
||
| [](https://pypi.python.org/pypi/behave-reportportal) | ||
| [](https://pypi.org/project/behave-reportportal) | ||
| [](https://github.com/reportportal/agent-python-behave) | ||
| [](https://codecov.io/gh/reportportal/agent-python-behave) | ||
| [](https://slack.epmrpp.reportportal.io/) | ||
| [](http://stackoverflow.com/questions/tagged/reportportal) | ||
|
|
||
| Behave extension for reporting test results of Behave to the ReportPortal. | ||
|
|
||
| - **Usage** | ||
| - **Installation** | ||
| - **Configuration** | ||
| - **Launching** | ||
| - **Test item attributes** | ||
| - **Logging** | ||
| - **Test case ID** | ||
| - **Integration with GA** | ||
| - **Copyright Notice** | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Installation | ||
|
|
||
| To install agent-python-behave run: | ||
|
|
||
| ```bash | ||
| pip install behave-reportportal | ||
| ``` | ||
|
|
||
| You can find an example of integration with behave | ||
| agent [here](https://github.com/reportportal/agent-python-behave/blob/master/tests/features/environment.py). | ||
| You can just copy this file to your features folder. | ||
|
|
||
| ## Configuration | ||
|
|
||
| Prepare the config file `behave.ini` in the root directory of tests or specify | ||
| any one using behave command line option: | ||
|
|
||
| ```bash | ||
| behave -D config_file=<path_to_config_file> | ||
| ``` | ||
|
|
||
| The `behave.ini` file should have the following mandatory fields under `[report_portal]` section: | ||
|
|
||
| - `api_key` - value can be found in the User Profile section | ||
| - `project` - name of project in ReportPortal | ||
| - `endpoint` - address of ReportPortal Server | ||
|
|
||
| Example of `behave.ini`: | ||
|
|
||
| ```text | ||
| [report_portal] | ||
| api_key = fb586627-32be-47dd-93c1-678873458a5f | ||
| endpoint = http://192.168.1.10:8080 | ||
| project = user_personal | ||
| launch_name = AnyLaunchName | ||
| launch_attributes = Slow Smoke | ||
| launch_description = Smoke test | ||
| ``` | ||
HardNorth marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The following parameters are optional: | ||
|
|
||
| - `client_type = SYNC` - Type of the under-the-hood ReportPortal client implementation. Possible | ||
| values: [SYNC, ASYNC_THREAD, ASYNC_BATCHED]. | ||
| - `launch_name = AnyLaunchName` - launch name (default value is 'Python Behave Launch') | ||
| - `launch_id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` - id of the existing launch (the session will not handle the | ||
| lifecycle of the given launch) | ||
| - `launch_attributes = Smoke Env:Python3` - list of attributes for launch | ||
| - `launch_description = Smoke test` - launch description | ||
| - `debug_mode = True` - creates the launch either as debug or default mode (defaults to False) | ||
| - `log_layout = Nested` - responsible for Scenario, Step or Nested based logging (Scenario based approach is used by | ||
| default) | ||
| - `is_skipped_an_issue = False` - option to mark skipped tests as not 'To Investigate' items on Server side. | ||
| - `retries = 3` - amount of retries for performing REST calls to RP server | ||
| - `rerun = True` - marks the launch as the rerun | ||
| - `rerun_of = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` - launch id to rerun | ||
| - `launch_uuid_print = True` - Enables printing Launch UUID on test run start. Default `False`. | ||
| - `launch_uuid_print_output = stderr` - Launch UUID print output. Default `stdout`. Possible values: [stderr, stdout]. | ||
| - `connect_timeout = 15` - Connection timeout to ReportPortal server. Default value is "10.0". | ||
| - `read_timeout = 15` - Response read timeout for ReportPortal connection. Default value is "10.0". | ||
| - `log_batch_size = 20` - maximum number of log entries which will be sent by the agent at once | ||
| - `log_batch_payload_size = 65000000` - maximum payload size of a log batch which will be sent by the agent at once | ||
|
|
||
| If you would like to override the above parameters from command line, or from CI environment based on your build, then | ||
| pass: | ||
|
|
||
| - `-D parameter=value` during invocation. | ||
|
|
||
| ## Launching | ||
|
|
||
| To execute tests with ReportPortal run `behave` command and specify path to feature files: | ||
|
|
||
| ```bash | ||
| behave ./tests/features | ||
| ``` | ||
|
|
||
| ## Test item attributes | ||
|
|
||
| Tag `attribute` can be used to specify attributes for features and scenarios. | ||
| Attributes should be listed inside brackets of attribute tag separated by commas. | ||
|
|
||
| Example: | ||
|
|
||
| ```python | ||
| @attribute(key:value, value2) | ||
| @attribute(some_other_attribute) | ||
| Feature: feature name | ||
|
|
||
| @attribute(key:value, value2, value3) | ||
| Scenario: scenario name | ||
| ``` | ||
|
|
||
| ## Logging | ||
|
|
||
| For logging of the test item flow to ReportPortal, please, use the python | ||
| logging handler and logger class provided by extension like below. | ||
|
|
||
| In `environment.py`: | ||
|
|
||
| ```python | ||
| import logging | ||
|
|
||
| from reportportal_client import RPLogger, RPLogHandler | ||
|
|
||
| from behave_reportportal.behave_agent import BehaveAgent, create_rp_service | ||
| from behave_reportportal.config import read_config | ||
|
|
||
|
|
||
| def before_all(context): | ||
| cfg = read_config(context) | ||
| context.rp_client = create_rp_service(cfg) | ||
| context.rp_client.start() | ||
| context.rp_agent = BehaveAgent(cfg, context.rp_client) | ||
| context.rp_agent.start_launch(context) | ||
| logging.setLoggerClass(RPLogger) | ||
| log = logging.getLogger(__name__) | ||
| log.setLevel("DEBUG") | ||
| rph = RPLogHandler(rp_client=context.rp_client) | ||
| log.addHandler(rph) | ||
| context.log = log | ||
| ``` | ||
|
|
||
| Logger provides ability to attach some file in scope of log message (see examples below). | ||
|
|
||
| In steps: | ||
|
|
||
| ```python | ||
| @given("I want to calculate {number_a:d} and {number_b:d}") | ||
| def calculate_two_numbers(context, number_a, number_b): | ||
| context.number_a = number_a | ||
| context.number_b = number_b | ||
| context.log.info("log message") | ||
|
|
||
| # Message with an attachment. | ||
| import subprocess | ||
| free_memory = subprocess.check_output("free -h".split()) | ||
| context.log.info( | ||
| "log message with attachment", | ||
| attachment={ | ||
| "name": "free_memory.txt", | ||
| "data": free_memory, | ||
| "mime": "application/octet-stream", | ||
| }, | ||
| ) | ||
| ``` | ||
|
|
||
| ## Test case ID | ||
|
|
||
| It's possible to mark some scenario with `test_case_id(<some_id>)` tag. ID specified in brackets will be sent to | ||
| ReportPortal. | ||
|
|
||
| ## Integration with GA | ||
|
|
||
| ReportPortal is now supporting integrations with more than 15 test frameworks simultaneously. In order to define the | ||
| most popular agents and plan the team workload accordingly, we are using Google analytics. | ||
|
|
||
| ReportPortal collects information about agent name and its version only. This information is sent to Google analytics | ||
| on the launch start. Please help us to make our work effective. If you still want to switch Off Google analytics, | ||
| please change env variable the way below. | ||
|
|
||
| ```bash | ||
| export AGENT_NO_ANALYTICS=1 | ||
| ``` | ||
|
|
||
| ## Copyright Notice | ||
|
|
||
| Licensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license (see the LICENSE file). | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.