That's pretty good, but it won't tell bazel if the tests pass or fail. You need to add sys.exit to pass the exit code back to bazel. That being said, I'm having an issue with pytest and bazel getting confused by the module names.
This is my pytest log.
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
-----------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.5.2, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /home/vagrant/.cache/bazel/_bazel_vagrant/14760d7c33ea3e90d48de59613ccfeab/bazel-sandbox/7080476036616459591/execroot/vibes/bazel-out/k8-py3-fastbuild/bin/graphql/test_schema.runfiles/vibes, inifile:
collected 0 items / 1 errors
==================================== ERRORS ====================================
___________________ ERROR collecting graphql/test_schema.py ____________________
ImportError while importing test module '/home/vagrant/.cache/bazel/_bazel_vagrant/14760d7c33ea3e90d48de59613ccfeab/bazel-sandbox/7080476036616459591/execroot/vibes/bazel-out/k8-py3-fastbuild/bin/graphql/test_schema.runfiles/vibes/graphql/test_schema.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
ImportError: No module named 'graphql.test_schema'
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.46 seconds ============================