New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: only test enabled python bindings #21293
Conversation
@tchaikov make check failed but it doesn't look like it's because of the changes in this PR. |
retest this please. |
f8a337d
to
f28a096
Compare
f28a096
to
705980f
Compare
src/pybind/mgr/dashboard/run-tox.sh
Outdated
fi | ||
ENV_LIST+="cov-report,lint" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the change here is that when WITH_PYTHON2=ON and WITH_PYTHON3=OFF, py3 is not included in ENV_LIST
That seems reasonable to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, the change is to get the test pass, even if WITH_PYTHON2=OFF and WITH_PYTHON3=ON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sane to me. But haven't tested the code.
src/pybind/mgr/dashboard/run-tox.sh
Outdated
@@ -17,11 +17,14 @@ fi | |||
|
|||
source ${MGR_DASHBOARD_VIRTUALENV}/bin/activate | |||
|
|||
ENV_LIST="cov-init," | |||
if [ "$WITH_PYTHON2" = "ON" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we declared a default value for WITH_PYTHON2
in the beginning of the script (as we do with WITH_PYTHON3
) so that the script runs well outside ctest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rjfd fixed and repushed.
705980f
to
0d1ad13
Compare
@tchaikov I tested this PR in my environment where I have diff --git a/src/pybind/mgr/dashboard/run-tox.sh b/src/pybind/mgr/dashboard/run-tox.sh
index 564c75b308..fe11683245 100755
--- a/src/pybind/mgr/dashboard/run-tox.sh
+++ b/src/pybind/mgr/dashboard/run-tox.sh
@@ -25,7 +25,13 @@ fi
if [ "$WITH_PYTHON3" = "ON" ]; then
ENV_LIST+="py3,"
fi
-ENV_LIST+="cov-report,lint"
+ENV_LIST+="cov-report,"
+if [ "$WITH_PYTHON2" = "ON" ]; then
+ ENV_LIST+="lint2"
+fi
+if [ "$WITH_PYTHON3" = "ON" ]; then
+ ENV_LIST+="lint3"
+fi
tox -c ${TOX_PATH} -e $ENV_LIST
diff --git a/src/pybind/mgr/dashboard/tox.ini b/src/pybind/mgr/dashboard/tox.ini
index 743a8a6929..9b07e15e8e 100644
--- a/src/pybind/mgr/dashboard/tox.ini
+++ b/src/pybind/mgr/dashboard/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = cov-init,py27,py3,cov-report,lint
+envlist = cov-init,py27,py3,cov-report,lint2,lint3
skipsdist = true
[testenv]
@@ -30,9 +30,20 @@ commands =
coverage report
coverage xml
-[testenv:lint]
+[testenv:lint2]
+basepython=python2
setenv =
- PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.3:{toxinidir}/../../../../build/lib/cython_modules/lib.2
+ PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.2
+ LD_LIBRARY_PATH = {toxinidir}/../../../../build/lib
+deps=-r{toxinidir}/requirements.txt
+commands=
+ pylint --rcfile=.pylintrc --jobs=5 . module.py tools.py controllers tests services
+ pycodestyle --max-line-length=100 --exclude=python2.7,.tox,venv,frontend --ignore=E402,E121,E123,E126,E226,E24,E704,W503 .
+
+[testenv:lint3]
+basepython=python3
+setenv =
+ PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.3
LD_LIBRARY_PATH = {toxinidir}/../../../../build/lib
deps=-r{toxinidir}/requirements.txt
commands= Can you apply it to this PR? |
9635f30
to
473eacb
Compare
@rjfd i restructured the tox.ini to dedup the settings. could you take another look? thanks! |
src/pybind/mgr/dashboard/tox.ini
Outdated
deps=-r{toxinidir}/requirements.txt | ||
basepython = | ||
py27: python2.7 | ||
py3: python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some unknown reason, the virtual environments are being created outside of .tox
directory, please add this additional line to fix it:
envdir = {toxinidir}/.tox/{envname}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rjfd it's on purpose. i wanted to avoid creating the venvs in the source directory. see https://github.com/ceph/ceph/pull/21293/files#diff-cc2ee9d8e56f3a2cd98b8148935d3829R28. why do you think we should put them into .tox
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I usually run run-tox.sh
manually in the source directory and I was getting unstaged changes in my repo because of those directories. I was suggesting to move them into .tox
directory because .tox is in the .gitignore.
Instead of creating them inside .tox, we can add the virtualenv directories to the .gitignore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rjfd hmm, how about this:
- add a default value for
CEPH_BUILD_DIR
in run-tox.sh to point it to$PWD/.tox
?
anyway, IMHO, ctest
is a more handy way to run tests.
src/pybind/mgr/dashboard/tox.ini
Outdated
cov: coverage report | ||
cov: coverage xml | ||
lint: pylint --rcfile=.pylintrc --jobs=5 . module.py tools.py controllers tests services | ||
lint: pycodestyle --max-line-length=100 --exclude=python2.7,.tox,venv,frontend --ignore=E402,E121,E123,E126,E226,E24,E704,W503 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove the python2.7
from the exclude filter.
473eacb
to
adbab1b
Compare
changelog
@rjfd fixed and repushed. |
we should test the python version of MGR_PYTHON_VERSION_MAJOR, if we are testing both py2.7 and py3, we are preparing for distributing dashboard as a separated package independent of ceph-mgr. restructure the dashboard tests as 2 matrices, so we have 2*2 tests for coverage and lint respectively. Signed-off-by: Kefu Chai <kchai@redhat.com>
adbab1b
to
213652a
Compare
unlike ceph-disk and ceph-detect-init, dashboard is not a standalone python application, it is a python application hosted by ceph-mgr, so no need to create a venv in which it is deployed. the python env created by tox would suffice. Signed-off-by: Kefu Chai <kchai@redhat.com>
changelog
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
this silences following errors: 9: ./awsauth.py:42:1: E722 do not use bare except' 9: ./awsauth.py:116:13: E722 do not use bare except' Signed-off-by: Kefu Chai <kchai@redhat.com>
failed tests are |
This PR causes a make check problem, see http://tracker.ceph.com/issues/23709. |
#21416 should address this problem. |
we should test the python version of MGR_PYTHON_VERSION_MAJOR, if we are
testing both py2.7 and py3, we are preparing for distributing dashboard
as a separated package independent of ceph-mgr.