-
Notifications
You must be signed in to change notification settings - Fork 400
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
Add code coverage #946
Add code coverage #946
Conversation
@francoisfreitag @rbarrois What do you guys think about this? .. Also it would be nice if you create a key over at codecov / equivalent to upload all the files there and not have to download them to see them (PS you will only be able to download the files for a day) :/ |
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.
LMKWYT
- "3.10" | ||
- "pypy-3.7" | ||
- "pypy-3.8" | ||
- ["3.7", "py37"] |
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.
Adds pretty names.. for the coverage filename. If we move this to codecov / alternative, there would be no need to have this around.
if: matrix.run-coverage == 'yes' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: factory_coverage_${{ matrix.python-version[1] }}_${{ matrix.database-type }} |
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.
Would be nice to move this over to a codecov / equivalent and not have to download it..
Makefile
Outdated
@@ -3,9 +3,21 @@ TESTS_DIR=tests | |||
DOC_DIR=docs | |||
EXAMPLES_DIR=examples | |||
SETUP_PY=setup.py | |||
PYTHON_TEST=python \ |
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.
Moved this here to reuse it for coverage support
postgres: DJANGO_SETTINGS_MODULE=tests.djapp.settings_pg | ||
|
||
whitelist_externals = make | ||
commands = make test | ||
commands = | ||
!cov: make test |
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.
Didn't want to force anyone to use nocov
, this way its more "intelligent", even though there is a bit of "magic".
In the spirit of openness; There is an issue that has alluded me, this only happens sometimes, and only when using pypy{3.7, 3.8} + sqlalchemy + sqlite + coverage. I have been able to reproduce this locally too, but haven't understood the cause. There seems to be little to no information about this issue. It's always the same error in the same place
example 3.7 failed Update: Tested it like this (i=0
while (true); do
i=$((i+1))
echo
echo "running tests $i"'!!'
echo
time tox -e pypy37-django32-mongo-alchemy-sqlite-cov
if [ ! "$?" = "0" ]; then
printf '\a\n'
echo "took $i tries"'!!'
break
fi
done) I think i fixed it. It usually failed around 5-10 iterations. I'm by 68 and no crash!! happy dance |
Makefile
Outdated
@rm -rf .coverage htmlcov/ | ||
|
||
coverage-test: | ||
$(PYTHON_ERROR_ON_WARN) $(COVERAGE_PATH) run -m unittest |
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.
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.
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.
@rbarrois friendly bump :)
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.
@rbarrois friendly bump :)
There is no point having this around |
When working on the PR "Implements bulk_create for create_batch if available" I found the need to ensure that all the code I wrote was properly tested/covered under tests. Started experimenting and came up with this PR to add coverage when using the CI