File tree Expand file tree Collapse file tree 4 files changed +17
-14
lines changed Expand file tree Collapse file tree 4 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -10,3 +10,4 @@ build-backend = "setuptools.build_meta"
10
10
11
11
[tool .setuptools_scm ]
12
12
local_scheme = " no-local-version"
13
+ write_to = " src/pytest_html/__version.py"
Original file line number Diff line number Diff line change
1
+
2
+ # file generated by setuptools_scm. don't track in version control
3
+ pytest_html /__version.py
Original file line number Diff line number Diff line change 1
- from pkg_resources import DistributionNotFound
2
- from pkg_resources import get_distribution
3
-
4
-
5
1
try :
6
- __version__ = get_distribution (__name__ ).version
7
- except DistributionNotFound :
8
- # package is not installed
2
+ from . import __version
3
+
4
+ __version__ = __version .version
5
+ except ImportError :
6
+ # package is not built with setuptools_scm
9
7
__version__ = "unknown"
10
8
11
9
__pypi_url__ = "https://pypi.python.org/pypi/pytest-html"
Original file line number Diff line number Diff line change 17
17
from html import escape
18
18
from os .path import isfile
19
19
20
- import pkg_resources
21
20
import pytest
22
21
from _pytest .logging import _remove_ansi_escape_sequences
23
22
from py .xml import html
@@ -474,9 +473,10 @@ def _generate_report(self, session):
474
473
numtests = self .passed + self .failed + self .xpassed + self .xfailed
475
474
generated = datetime .datetime .now ()
476
475
477
- self .style_css = pkg_resources .resource_string (
478
- __name__ , os .path .join ("resources" , "style.css" )
479
- ).decode ("utf-8" )
476
+ with open (
477
+ os .path .join (os .path .dirname (__file__ ), "resources" , "style.css" )
478
+ ) as style_css_fp :
479
+ self .style_css = style_css_fp .read ()
480
480
481
481
if ansi_support ():
482
482
ansi_css = [
@@ -597,9 +597,10 @@ def generate_summary_item(self):
597
597
),
598
598
]
599
599
600
- main_js = pkg_resources .resource_string (
601
- __name__ , os .path .join ("resources" , "main.js" )
602
- ).decode ("utf-8" )
600
+ with open (
601
+ os .path .join (os .path .dirname (__file__ ), "resources" , "main.js" )
602
+ ) as main_js_fp :
603
+ main_js = main_js_fp .read ()
603
604
604
605
session .config .hook .pytest_html_report_title (report = self )
605
606
You can’t perform that action at this time.
0 commit comments