Remove pkg_resources (#396)
* remove pkg_resources from `plugin.py` * removed pkg_resources from `__init__.py` Co-authored-by: Sorin Sbarnea <ssbarnea@redhat.com>
This commit is contained in:
parent
38db4e3faf
commit
d0984435f9
|
@ -10,3 +10,4 @@ build-backend = "setuptools.build_meta"
|
|||
|
||||
[tool.setuptools_scm]
|
||||
local_scheme = "no-local-version"
|
||||
write_to = "src/pytest_html/__version.py"
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
# file generated by setuptools_scm. don't track in version control
|
||||
pytest_html/__version.py
|
|
@ -1,11 +1,9 @@
|
|||
from pkg_resources import DistributionNotFound
|
||||
from pkg_resources import get_distribution
|
||||
|
||||
|
||||
try:
|
||||
__version__ = get_distribution(__name__).version
|
||||
except DistributionNotFound:
|
||||
# package is not installed
|
||||
from . import __version
|
||||
|
||||
__version__ = __version.version
|
||||
except ImportError:
|
||||
# package is not built with setuptools_scm
|
||||
__version__ = "unknown"
|
||||
|
||||
__pypi_url__ = "https://pypi.python.org/pypi/pytest-html"
|
||||
|
|
|
@ -17,7 +17,6 @@ from functools import lru_cache
|
|||
from html import escape
|
||||
from os.path import isfile
|
||||
|
||||
import pkg_resources
|
||||
import pytest
|
||||
from _pytest.logging import _remove_ansi_escape_sequences
|
||||
from py.xml import html
|
||||
|
@ -474,9 +473,10 @@ class HTMLReport:
|
|||
numtests = self.passed + self.failed + self.xpassed + self.xfailed
|
||||
generated = datetime.datetime.now()
|
||||
|
||||
self.style_css = pkg_resources.resource_string(
|
||||
__name__, os.path.join("resources", "style.css")
|
||||
).decode("utf-8")
|
||||
with open(
|
||||
os.path.join(os.path.dirname(__file__), "resources", "style.css")
|
||||
) as style_css_fp:
|
||||
self.style_css = style_css_fp.read()
|
||||
|
||||
if ansi_support():
|
||||
ansi_css = [
|
||||
|
@ -597,9 +597,10 @@ class HTMLReport:
|
|||
),
|
||||
]
|
||||
|
||||
main_js = pkg_resources.resource_string(
|
||||
__name__, os.path.join("resources", "main.js")
|
||||
).decode("utf-8")
|
||||
with open(
|
||||
os.path.join(os.path.dirname(__file__), "resources", "main.js")
|
||||
) as main_js_fp:
|
||||
main_js = main_js_fp.read()
|
||||
|
||||
session.config.hook.pytest_html_report_title(report=self)
|
||||
|
||||
|
|
Loading…
Reference in New Issue