Skip to content

Commit 080da76

Browse files
committed
Run Python test on Mac M1 in virtual environment to prevent "error: externally-managed-environment".
1 parent d2a08b9 commit 080da76

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/build_wheels_macos_m1.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,24 @@ jobs:
9898
with:
9999
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
100100
path: wheelhouse/
101+
- name: Create Venv for test
102+
run: |
103+
test -d "${{ github.workspace }}/opencv_test" && rm -rf "${{ github.workspace }}/opencv_test"
104+
python${{ matrix.python-version }} -m venv ${{ github.workspace }}/opencv_test
101105
- name: Package installation
102106
run: |
103-
python${{ matrix.python-version }} -m pip install --user --no-cache --force-reinstall wheelhouse/opencv*.whl
107+
source ${{ github.workspace }}/opencv_test/bin/activate
108+
python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl
104109
cd ${{ github.workspace }}/tests
105110
python${{ matrix.python-version }} get_build_info.py
106111
- name: Run tests
107112
run: |
113+
source ${{ github.workspace }}/opencv_test/bin/activate
108114
cd ${{ github.workspace }}/opencv
109115
python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
110116
- name: Pylint test
111117
run: |
118+
source ${{ github.workspace }}/opencv_test/bin/activate
112119
python${{ matrix.python-version }} -m pip install pylint==2.15.9
113120
cd ${{ github.workspace }}/tests
114121
python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE

0 commit comments

Comments
 (0)