Commit Graph

99 Commits

Author SHA1 Message Date
Sorin Sbarnea cbfc38d4c7
Consolidate tox environments (#328) 2020-08-11 13:54:34 +01:00
Sorin Sbarnea 955eb440cc
Merge branch 'master' into fix-ansi-in-report 2020-08-10 13:16:46 +01:00
Gleb Nikonorov 4dfec1cdec
Make the links column in the results table sortable (#324)
* Make the links column sortable
2020-08-04 16:41:42 +02:00
Michał Bielawski 4556076800
Make the maximum asset filename length configurable. (#313)
* Make the maximum asset filename length configurable.
2020-07-27 14:16:00 +02:00
Jim Brännlund 3a4efa1d18 Strip ANSI escape sequences when ansi2html is missing
Fixes: #314
2020-07-16 19:15:44 +02:00
Zac-HD 97f275f47d Rename for xdist compatibility
Fixes #305
2020-06-14 18:10:35 +10:00
Christian Sandberg fea4eb3f3d Fix image missing when using Base64 content 2020-03-21 19:39:32 +01:00
Christian Sandberg a86bb59a50 Remove global variable 2020-03-17 19:48:36 +01:00
Christian Sandberg 559cc17174 Use config object to store extras 2020-03-17 19:47:46 +01:00
Christian Sandberg a8292bbab2 Remove usage of funcargs
Fixes #282
2020-03-12 19:57:40 +01:00
Christian Sandberg 145c746a07 Add extra fixture 2020-02-29 19:50:21 +01:00
werdeil 966228c3ea Add hook to change report main title 2020-02-28 13:41:01 +01:00
Jim Brännlund 301d52f150 Fix collapsable bug 2020-02-20 12:12:12 -05:00
Jim Brännlund ac30b65c34 Control render using configuration 2020-02-15 02:46:49 +01:00
Maxime Jacob d6bc3ab6cf Added an extra test to cover the case where a href would be contained in the dictionary.
Dictionary string generation now uses json.dumps instead of the handmade json.dumps.
2020-02-05 18:09:18 -05:00
Maxime Jacob 753ca944ea Merge branch 'master' of https://github.com/pytest-dev/pytest-html 2020-02-05 17:15:36 -05:00
Maxime Jacob 494630279d Fixed issue where values could get to the html without being first converted to a string. This caused a runtime
error.
2020-02-04 20:28:17 -05:00
Maxime Jacob 27b9051970 Added support for ordering metadata dictionaries by key. This compare requires casting the keys to string, as
far as I know.
2020-02-04 20:03:23 -05:00
Maxime Jacob 588c41b33f As discussed, this deals with the code duplication introduced in #260. These changes aimed at generelizing the
approach used to introduce media types to the project. Images and videos now use a method called
_make_media_html_div which generates the media div in a streamlined manner. Both _append_image and _append_video
use this method, to which they can pass their base string and class.

Unit tests were left untouched, as the changes only affect private methods.
2020-02-03 21:53:01 -05:00
Maxime Jacob f03b9d9a4b Added the CSS specification for the video class. It is pretty much a duplicate of the image css.
Code for the video extra has been extracted to a function to clean up a bit the if/elif/elif that is starting to
get pretty big. Maybe the other conditions could be extracted to their own method to clean up a bit. Once again,
there seems to be a lot of code duplication with image, so we may want to refactor images, videos, and audio as
a media type and have some kind of template method.

Basic unit tests were added to make sure that the extra was correctly added to the report when the extra was
requested.
2020-02-01 21:01:19 -05:00
Maxime Jacob 8de28f6d1f Added support for the mp4 video format.
Support uses the raw html section in order to pass a video tag which is compatible with html5.

Video size and style should be handled by the "video" class in the css file.
2020-01-30 22:02:02 -05:00
Andy.Yang 3d5e3340aa
Merge branch 'master' into master 2019-11-05 14:48:52 +08:00
Krzysztof Pawlik 7166364ad4 Close opened resource. (#235)
* Close opened resource.

* Update pytest_html/plugin.py

Co-Authored-By: Bruno Rocha <rochacbruno@users.noreply.github.com>

* Use `f""` instead of `.format()` call.

* Add validation for raised warnings to tests.
2019-11-03 04:58:59 +01:00
Andy.Yang f251cea504
Update plugin.py
Support Chinese display

[before]:
TestForSyncProduct::test_1_valueValid[test Case Name-add]  
TestForSyncProduct::test_2_valueValid[\u6d4b\u8bd5\u7528\u4f8b\u540d\u79f0-update]

[now]:
TestForSyncProduct::test_1_valueValid[test Case Name-add]
TestForSyncProduct::test_2_valueValid[测试用例名称-update]
2019-10-11 11:52:35 +08:00
Hugo van Kemenade e6e5ef2585 Drop support for legacy Python 2.7 (#230)
* Drop support for legacy Python 2.7

* Upgrade Python syntax with pyupgrade --py36-plus

* Require pytest 5+, supports only Python 3

* Format with Black
2019-09-09 10:10:07 +02:00
Jim Brännlund 9dd249f200
Fix assets file naming to work across both *nix and windows (#223)
* Fix assets file naming to work across both *nix and windows

Fixes #214
Fixes #213

* Better replacement strategy for test id

* Update markers
2019-08-06 13:57:05 +02:00
Jim Brännlund 8e96c6ed94
Migrate to 'black' for consistent styling and formatting (#218)
* Migrate to 'black' for consistent styling and formatting

* Add black to tox and travis
2019-08-04 14:09:46 +02:00
Sam Clements b3cf28a84b
Append a line break after captured log sections
The content in log sections doesn't always include a trailing newline, so this includes one afterwards ensuring that the next section header is placed on a new line. If there's already a trailing newline, this has no effect as it uses `<br>`.
2019-07-09 14:14:39 +01:00
Michał Bielawski 623efc6198 Truncate long test names in assets. 2019-06-19 15:40:12 +01:00
Sorin Sbarnea 6ff7b9616a Allow opening generated html report in browser (#208)
By default terminals would open files in editors and URLs in browsers.

By printing the generated html report using an URL (file://) we enable
users to click the terminal to open it. Previously this opened the file
in the text editor which is very unlikely to be what user would want.
2019-06-17 13:04:03 -03:00
Jim Brännlund 582c29fb5a Handle when report title is stored as an environment variable
When the --html flag is used in pytest.ini with "addopts" and the
report title is stored in an environment variable, the name of the
environment variable was used as the report title.

In other words, the environment variable was never expanded.

Fixes: #201
2019-04-26 11:08:20 +02:00
Iulia Liakh 27b6e77ab1 Change assets naming method (#199)
* added assets name hashing option

* from command line option to config option

* new naming strategy

* fix

* Flake8 issues fixed

* more Flake8 issues fixed
2019-02-19 06:34:01 -03:00
chardbury 75cfd52da1 Removed extraneous space from anchor tag (#192) 2019-01-12 10:05:19 -03:00
Ankit Goel cf21aed363 Stop filtering out falsy environment values
Fixes #175
2018-10-04 17:07:12 +01:00
Ankit Goel 21b80148b3 Refactor css config code
Change the default value for `--css` option to an empty array instead of
None since the config reading code is doing that manually.
2018-10-04 16:30:41 +01:00
Jace Browning fb6a456415 Disable sort on environment table when metadata is ordered 2018-05-22 11:31:53 +01:00
Dave Hunt 51c77d5c3f
Finish up the custom CSS support including docs and tests 2018-04-05 13:29:13 +01:00
David Fernandez f8fcd88c08
Added option to append one or more user-provided style sheets to report's styling. 2018-04-05 13:13:32 +01:00
Dave Hunt ebebda43dd
Report collection errors in HTML report. (#154)
Fixes #148
2018-04-05 11:31:56 +01:00
Joep Schuurkes d5031769b6 Add hook for modifying summary section (#152)
Closes #109
2018-04-05 11:31:20 +01:00
Joep Schuurkes abf8f15e4e adds filename of report as title to html body 2018-03-26 16:22:57 +01:00
Jeffry Pincus c61dc5bbe0 Fix for including a screenshot bug on Windows (#136)
Fixes #124
2018-01-04 12:48:33 +00:00
Rasmus Pedersen 950b889108 Improve rendering of collections in metadata (#132)
Render metadata collection values as comma seperated strings.
2017-09-19 04:04:34 -04:00
Dave Hunt 0c442e43ae Minor style improvements 2017-08-15 09:16:32 +01:00
Chingiz_Toimbetov e9b2433549 Decode all bytes strings in extra text. 2017-08-15 09:06:09 +01:00
Tomasz Gajewski a0cade6e0c
Fixed handling unicode longrepr values. Fixes #114. 2017-06-09 15:47:25 +01:00
Jim Brännlund f19a86d1e3
Add ability to specify images as file or URL
Fixes #77
2017-06-06 14:31:19 +01:00
Dave Hunt 4c81503c69
Always encode content for data URI
Fixes #106
2017-03-08 16:23:38 +00:00
Dave Hunt 9547951d44
Present metadata without additional formatting to avoid issues due to unpredictable content typypes 2017-02-28 08:43:05 +00:00
Dave Hunt bc2e8a3555
Add hooks for modifying the test results table 2017-02-27 15:06:26 +00:00