Skip to content

Commit ad83328

Browse files
committed
1.7.3
1 parent 55cddb5 commit ad83328

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

pytest_echo.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import print_function
3-
41
import fnmatch
52
import os
63
from pprint import pformat
74

8-
import pkg_resources
9-
from pkg_resources import DistributionNotFound
10-
11-
__version__ = '1.7.1'
5+
import pytest
126

137

148
def get_installed_distributions():
159
"""
1610
Return a list of installed Distribution objects.
1711
"""
18-
return [d for d in pkg_resources.working_set]
12+
try:
13+
import pkg_resources
14+
return [d for d in pkg_resources.working_set]
15+
except (ImportError, AttributeError, TypeError):
16+
pass
1917

2018

2119
def get_attr(obj, attr, default='NOT FOUND'):
@@ -126,7 +124,7 @@ def _get_version(package_name):
126124
import pkg_resources
127125

128126
return pkg_resources.require(package_name)[0].version
129-
except (ImportError, AttributeError, TypeError, DistributionNotFound):
127+
except (ImportError, AttributeError, TypeError):
130128
pass
131129

132130
try:
@@ -168,6 +166,7 @@ def pytest_report_header(config):
168166
return "\n".join(ret)
169167

170168

169+
@pytest.hookimpl()
171170
def pytest_addoption(parser):
172171
group = parser.getgroup("general")
173172
group.addoption('--echo-env', action='append', dest="echo_envs",

0 commit comments

Comments
 (0)