Skip to content

Commit

Permalink
Print installed packages in pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
niboshi committed Oct 31, 2019
1 parent 93a5469 commit b4814d2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
import subprocess
import sys

from chainer import testing
from chainer.testing import parameterized
Expand All @@ -9,6 +11,26 @@
assert _pairwise_parameterize in ('never', 'always')


def _is_pip_installed():
try:
import pip # NOQA
return True
except ImportError:
return False


def _is_in_ci():
ci_name = os.environ.get('CHAINER_CI', '')
return ci_name != ''


def pytest_configure(config):
# Print installed packages
if _is_in_ci() and _is_pip_installed():
print("***** Installed packages *****", flush=True)
subprocess.check_call([sys.executable, '-m', 'pip', 'freeze', '--all'])


def pytest_collection(session):
# Perform pairwise testing.
# TODO(kataoka): This is a tentative fix. Discuss its public interface.
Expand Down

0 comments on commit b4814d2

Please sign in to comment.