Closed pgkirsch closed 2 years ago
Does #105 fix this?
No, I don't think it will. Thank you for the reminder.
@bqpd do you have suggestions for unit tests that use gpkit.tests.helpers.generate_example_tests
when the example/test files live in a subdirectory of docs
which is not included as a package inside GPfit. Is the only appropriate solution to move the docs
dir into gpfit/gpfit/
?
I might just skip the docs/example tests when it's a PyPi install (see t_examples.py
) :grimacing: bad practice, I know
There might be the alternate option of including docs
as a data directory, using the package_data
attribute
Thanks @bqpd this was the nudge I needed. I used include_package_data=True
added a MANIFEST.in
.
ahaha glad to hear you're doing it the right way!
Although doesn't seem to have worked... (Thanks @galbramc for retesting)
I tested locally when I made the change and the tar-zip included the directories it was supposed to, so I'm kinda confused.
@galbramc sorry to ask more of you, but I have a few questions about Jenkins to try to understand what's going on. My problem seems to be that the directory tests/artifacts/
doesn't exist in the version installed on Macys and Reynolds, despite being included in my locally generated dist/
tarballs.
'--omit=gpfit/tests/*'
in the line below? Is it relevant to the issue I am describing?
++ python /Users/jenkins/workspace/CE_gpfit_PR_unit_tests/buildnode/macys/venv2_gpfit/bin/coverage run --source=gpfit '--omit=gpfit/tests/*' test.py
gpfit.maths
in setup.py
. This caused my tests to fail locally and that's why I made the change in 11013ad, but I'm confused why those tests weren't failing on Jenkins. Do you know why that would be the case?FileNotFoundError: [Errno 2] No such file or directory: '/Users/jenkins/Library/Caches/pylint'
--omit=gpfit/tests/*
simply means don't include the testing files when generating coverage information. The coverage information tells you how much of your code is actually getting tested, and the testing files them selves artifcially inflate the numbers.msg-template={path}:{module}:{line}: [{msg_id}({symbol}), {obj}] {msg}
It looks like something is wrong with pylint.sh in the gpfit repo. Can you run it locally on your machine?
Well I didn't know github would replace the text with strings. You can grab the "unprotected Markdown" code from here:
https://acdl.mit.edu/csi/view/convex%20engineering/job/CE_gpfit_Push_pylint/badge/ https://acdl.mit.edu/csi/view/convex%20engineering/job/CE_gpfit_Push_unit_tests/badge/
Thanks @galbramc.
artifacts/
.msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
which seems to be missing the {module}
part -- I will update this.pylint.sh
seems to run fine for me locally:
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Updated the README, thanks!
To expand upon my response to 2 above
Is there something in the logs (or that I could add to gpfit) that would help me understand what is being installed on the VMs?
I am seeing things like:
Checking out Revision 03b40d235eb9a32ccd05b8e69d038a5bcf45ebf6 (origin/pr/105/merge, origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 03b40d235eb9a32ccd05b8e69d038a5bcf45ebf6 # timeout=3
Commit message: "Merge 11013ade4147129f04d2cc5ec885cd2beb8f5cf0 into 930b2dc4bdabea0f44edcf02fc418806c41fb96a"
(where 11013 was latest commit of v1 and 930b2 is the latest commit of master) and
Successfully installed gpfit-0.2.0
that make me believe the right thing is being built but I'm still very confused why some of the behaviour seems to suggest outdated code is being tested.
It turns out that pylint.sh was getting called in the "unit_tests", which it should not have been. That is fixed.
I don't know what the problem is with the artifacts directiry, but gpkit and gpfit are installed with the commands:
#Install GPkit
git clone --depth 1 https://github.com/convexengineering/gpkit.git $WORKSPACE/gpkit
python $PIP install -v --no-cache-dir -e $WORKSPACE/gpkit
# Install gpfit to run the documentation examples
python $PIP install -e $WORKSPACE/
gpfit is checked out in the $WORKSPACE directory. Does this help?
I added a print statment to show you the current working directory in the script to hopefully help with the artifacts problem
Unit tests now run on a clean pip-installed GPfit (v0.2.0)! 🎉
[20:46:59]$ pytest --pyargs gpfit
========================================== test session starts ===========================================
platform darwin -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
Matplotlib: 3.4.3
Freetype: 2.6.1
rootdir: /Users/philippe.kirschen/Documents
plugins: mpl-0.13
collected 60 items
tests/test_constraint_set.py .. [ 3%]
tests/test_evaluate.py ............ [ 23%]
tests/test_examples.py ss [ 26%]
tests/test_fit.py ........... [ 45%]
tests/test_initialize.py ... [ 50%]
tests/test_least_squares.py .... [ 56%]
tests/test_logsumexp.py .............. [ 80%]
tests/test_plot_fit.py ......... [ 95%]
tests/test_print_fit.py ... [100%]
============================================ warnings summary ============================================
tests/test_constraint_set.py::TestFitConstraintSet::test_outside_bounds
/Users/philippe.kirschen/opt/anaconda3/envs/gpfit020/lib/python3.9/site-packages/numpy/core/fromnumeric.py:86: UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=============================== 58 passed, 2 skipped, 1 warning in 41.32s ================================
The two skipped tests are the examples tests that can't be reached when docs/source/examples
aren't in path.
Unit tests currently fail on a fresh pip installation for two reasons:
initsolwarnings
).