Merge pull request #10568 [BEAM-9061] Add version guards to requirements file for integration tests.
diff --git a/sdks/python/scripts/run_integration_test.sh b/sdks/python/scripts/run_integration_test.sh
index 1133147..0804ace 100755
--- a/sdks/python/scripts/run_integration_test.sh
+++ b/sdks/python/scripts/run_integration_test.sh
@@ -194,8 +194,10 @@
fi
# Install test dependencies for ValidatesRunner tests.
- echo "pyhamcrest" > postcommit_requirements.txt
- echo "mock" >> postcommit_requirements.txt
+ # pyhamcrest==1.10.0 doesn't work on Py2.
+ # See: https://github.com/hamcrest/PyHamcrest/issues/131.
+ echo "pyhamcrest!=1.10.0,<2.0.0" > postcommit_requirements.txt
+ echo "mock<3.0.0" >> postcommit_requirements.txt
# Options used to run testing pipeline on Cloud Dataflow Service. Also used for
# running on DirectRunner (some options ignored).
diff --git a/sdks/python/setup.py b/sdks/python/setup.py
index 8599b7f..65bfdbd 100644
--- a/sdks/python/setup.py
+++ b/sdks/python/setup.py
@@ -181,8 +181,9 @@
'nose_xunitmp>=0.4.1',
'pandas>=0.23.4,<0.25',
'parameterized>=0.6.0,<0.8.0',
- # pyhamcrest==1.10.0 requires Py3. Beam still supports Py2.
- 'pyhamcrest>=1.9,<1.10.0',
+ # pyhamcrest==1.10.0 doesn't work on Py2. Beam still supports Py2.
+ # See: https://github.com/hamcrest/PyHamcrest/issues/131.
+ 'pyhamcrest>=1.9,!=1.10.0,<2.0.0',
'pyyaml>=3.12,<6.0.0',
'requests_mock>=1.7,<2.0',
'tenacity>=5.0.2,<6.0',