Skip to content

Commit ce72935

Browse files
committed
fix tox tests on theia
Signed-off-by: Chris Snow <[email protected]>
1 parent 96af5c8 commit ce72935

13 files changed

+45
-61
lines changed

Dockerfile

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,36 @@ COPY requirements.txt /tmp
55
RUN sudo apt-get update \
66
# && sudo apt-get install -y software-properties-common \
77
# && sudo add-apt-repository -y ppa:deadsnakes/ppa \
8-
&& sudo apt-get update \
8+
&& sudo apt-get remove --purge -y python \
99
&& sudo apt-get install -y python-pip python3-pip python3-sphinx vim
1010
# && sudo apt-get install -y python3.5 python3.6 python3.7 python3.8 python3.9 python3.9-distutils
1111

1212
RUN sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
1313
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
14-
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
15-
16-
RUN git clone https://github.com/pyenv/pyenv.git /home/theia/.pyenv
17-
RUN git clone https://github.com/momo-lab/xxenv-latest.git /home/theia/.pyenv/plugins/xxenv-latest
18-
RUN echo 'export PYENV_ROOT="/home/theia/.pyenv"' >> /home/theia/.bashrc
19-
RUN echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> /home/theia/.bashrc
20-
RUN echo 'if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)"; fi' >> /home/theia/.bashrc
21-
22-
RUN /home/theia/.pyenv/bin/pyenv latest install 2.7
23-
RUN /home/theia/.pyenv/bin/pyenv latest install 3.5
24-
RUN /home/theia/.pyenv/bin/pyenv latest install 3.6
25-
RUN /home/theia/.pyenv/bin/pyenv latest install 3.7
26-
RUN /home/theia/.pyenv/bin/pyenv latest install 3.8
27-
RUN /home/theia/.pyenv/bin/pyenv install 3.9-dev
28-
RUN /home/theia/.pyenv/bin/pyenv local $(/home/theia/.pyenv/bin/pyenv versions --bare)
29-
RUN /home/theia/.pyenv/bin/pyenv versions
30-
31-
# FIXME: Python 3.9 returns errors with pip
14+
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git \
15+
&& git clone https://github.com/pyenv/pyenv.git /home/theia/.pyenv \
16+
&& git clone https://github.com/momo-lab/xxenv-latest.git /home/theia/.pyenv/plugins/xxenv-latest \
17+
&& echo 'export PYENV_ROOT="/home/theia/.pyenv"' >> /home/theia/.bashrc \
18+
&& echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> /home/theia/.bashrc \
19+
&& echo 'if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)"; fi' >> /home/theia/.bashrc
20+
21+
RUN /home/theia/.pyenv/bin/pyenv latest install 2.7 \
22+
&& /home/theia/.pyenv/bin/pyenv latest install 3.5 \
23+
&& /home/theia/.pyenv/bin/pyenv latest install 3.6 \
24+
&& /home/theia/.pyenv/bin/pyenv latest install 3.7 \
25+
&& /home/theia/.pyenv/bin/pyenv latest install 3.8 \
26+
&& /home/theia/.pyenv/bin/pyenv install 3.9-dev \
27+
&& /home/theia/.pyenv/bin/pyenv local $(/home/theia/.pyenv/bin/pyenv versions --bare) \
28+
&& /home/theia/.pyenv/bin/pyenv versions
29+
3230
RUN echo "Installing python modules" \
3331
&& PYENV_PATHS=$(ls -1 /home/theia/.pyenv/versions/*/bin/python?.?) \
3432
&& PYENV_3PATHS=$(ls -1 /home/theia/.pyenv/versions/*/bin/python3.?) \
3533
&& for v in ${PYENV_PATHS}; do ${v} -m pip install --upgrade pip; done \
36-
&& for v in ${PYENV_PATHS}; do ${v} -m pip install -U tox-pyenv ipython pylint pytest mock nose flake8-docstrings isort; done \
37-
&& for v in ${PYENV_3PATHS}; do ${v} -m pip install -U black; done \
38-
&& sudo ln -f -s /home/theia/.local/bin/black /bin/ \
34+
&& for v in ${PYENV_PATHS}; do ${v} -m pip install -U tox tox-pyenv ipython pylint pytest mock nose flake8-docstrings; done \
35+
&& /home/theia/.pyenv/versions/*/bin/python3.8 -m pip install -U black isort \
36+
&& sudo ln -f -s /home/theia/.pyenv/versions/*/bin/black /bin/ \
37+
&& sudo ln -f -s /home/theia/.pyenv/versions/*/bin/isort /bin/ \
3938
&& for v in ${PYENV_PATHS}; do ${v} -m pip install -r /tmp/requirements.txt; done
4039

4140
RUN echo 'PATH=$PATH:/home/theia/.local/bin/' >> /home/theia/.bashrc

pre_push_verifications.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,26 @@
22

33
set -e
44

5-
isort tests/*.py
6-
isort hpecp/**.py
7-
isort bin/*.py
8-
5+
isort tests/*.py hpecp/**.py bin/*.py
96
black bin/ tests/ hpecp/
107

118
#flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
129
flake8 --docstring-convention numpy bin/ hpecp/
1310

14-
flake8 --ignore=D,E501 tests/cli_test.py # don't verify documentation in tests
11+
flake8 --ignore=D,E501 tests/ # verify tests, but not for documentation
1512

16-
if [[] -d /home/theia/ ]];
13+
if [[ -d /home/theia/ ]];
1714
then
18-
# ensure pyenvs are avaialble
19-
/home/theia/.pyenv/bin/pyenv local $(/home/theia/.pyenv/bin/pyenv versions --bare)
15+
# ensure pyenvs are available to tox
16+
eval "$(pyenv init -)"
17+
pyenv shell $(/home/theia/.pyenv/bin/pyenv versions --bare)
18+
tox --recreate --tox-pyenv-no-fallback -- tests/
19+
else
20+
tox -- tests/
2021
fi
21-
tox --recreate -- tests/
2222

23-
echo "********** FIXME: tox should test py27 as well **********"
23+
24+
echo "********** FIXME: 'tox -e py27' is broken **********"
2425

2526
# coverage causes some tests to fail on PY3 so test it (issues 93)
2627
#coverage3 erase && coverage3 run --source hpecp,bin setup.py test && coverage3 report -m

tests/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ def registerHttpDeleteHandler(cls, url, response):
171171
@classmethod
172172
def setUpClass(cls):
173173

174-
_http_get_handlers = {}
175-
_http_post_handlers = {}
176-
_http_put_handlers = {}
177-
_http_delete_handlers = {}
174+
_http_get_handlers = {} # noqa: F841
175+
_http_post_handlers = {} # noqa: F841
176+
_http_put_handlers = {} # noqa: F841
177+
_http_delete_handlers = {} # noqa: F841
178178

179179
# Register the login handler
180180
BaseTestCase.registerHttpPostHandler(

tests/cli_mock_api_responses.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
# OTHER DEALINGS IN THE SOFTWARE.
2020

2121

22-
from hpecp.exceptions import APIItemNotFoundException
23-
2422
from .base import BaseTestCase, MockResponse
2523

2624

tests/client_mock_api_responses.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
# OTHER DEALINGS IN THE SOFTWARE.
2020

2121

22-
from hpecp.exceptions import APIItemNotFoundException
23-
2422
from .base import BaseTestCase, MockResponse
2523

2624

tests/config_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@
1818
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1919
# OTHER DEALINGS IN THE SOFTWARE.
2020

21-
from unittest import TestCase
22-
23-
import requests
2421
from mock import patch
2522

2623
from hpecp import ContainerPlatformClient
2724

28-
from .base import BaseTestCase, MockResponse
25+
from .base import BaseTestCase
2926
from .config_mock_api_responses import mockApiSetup
3027

3128
# setup the mock data

tests/gateway_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
# OTHER DEALINGS IN THE SOFTWARE.
2020

2121
import tempfile
22-
from unittest import TestCase
2322

24-
import requests
2523
from mock import patch
2624

27-
from hpecp import APIItemNotFoundException, ContainerPlatformClient
25+
from hpecp import APIItemNotFoundException
2826
from hpecp.exceptions import APIItemConflictException
2927
from hpecp.gateway import GatewayController, GatewayStatus
3028

tests/k8s_worker_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from hpecp.exceptions import APIItemConflictException, APIItemNotFoundException
88
from hpecp.k8s_worker import K8sWorkerController, WorkerK8s, WorkerK8sStatus
99

10-
from .base import BaseTestCase, MockResponse, get_client
10+
from .base import BaseTestCase, get_client
1111
from .k8s_worker_mock_api_responses import mockApiSetup
1212

1313
# setup the mock data

tests/license_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import six
2525
from mock import patch
2626

27-
from .base import BaseTestCase, MockResponse
27+
from .base import BaseTestCase
2828
from .license_mock_api_responses import mockApiSetup
2929

3030
# setup the mock data

tests/role_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@
2121
import json
2222
from unittest import TestCase
2323

24-
import requests
2524
import six
2625
from mock import patch
2726

28-
from hpecp import ContainerPlatformClient
29-
30-
from .base import BaseTestCase, MockResponse, get_client
27+
from .base import BaseTestCase, get_client
3128
from .role_mock_api_responses import mockApiSetup
3229

3330
# setup the mock data

0 commit comments

Comments
 (0)