-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update renderers and fix warning about AcceptValidHeader.best_match deprecation (C4-627) #1455
base: master
Are you sure you want to change the base?
Conversation
… restart', 'make test-performance', and 'make test-integration'. Change order of 'make test-npm' and 'make test-unit' within 'make test' so that unit comes first.
…he rearranged fixture support from cgap-portal, which includes repairs to some of the html fixtures that specify they want text/html content. Move ORDER definition from datafixtures.py to conftest_settings.py. Adjust imports of ORDER. Mark test_fixtures as sloppy (causing this file not to run). Adjust test_indexing to use es_app/es_app_settings in places (as cgap does).
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.
All looks good to me, will need version bump when merged into master though (maybe target branch already has it)
@willronchetti, as noted above, I plan to do a major version bump to highlight the shift in behavior when an |
Some triaging of old and new renderers.py and test_renderers.py.
This ports various things from cgap-portal. In some cases, who files couldn't come over, so it's worth checking this to make sure the right parts did, but it makes the tests work. Please read the caveats in this bullet list to understand what needs most attention:
Port renderers support support and associated tests from
cgap-portal
. This means part ofsrc/encoded/renderers.py
got ported, so that bears some scrutiny. All ofsrc/encoded/tests/test_renderers.py
is brought over. Note that doing just this much actually breaksfourfront
tests because there was a misalignment in defaulting of mime types similar to something thatcgap-portal
went (harmlessly) through.In particular, if no mime-types are specified, this will default to
application/json
now, but this was never formerly tested and I"m not convinced the old default of HTML was a good one. All clients should be offering anAccept
header that will sort it out, and I think it's fair to say that modern browsers will send such a header.This is a small but important change. Whether it counts as a bug fix or a major version change is subjective. I'm inclined to think we should bump the major version just so if it results in issues it will be easy to spot. (Commit
[6fa56b5](https://github.com/4dn-dcic/fourfront/commit/6fa56b5ac8cbe52bc05b57b632ece059dae8e6e9)
is the relevant change.)Importantly, this will bring Fourfront and CGAP behavior back in line with one another. But also, we will have a set of unit tests that cover this space and if we need to make further adjustments we'll have a baseline to understand what we're affecting.
Much of
src/encoded/tests/conftest.py
is just rearranged into a better order and with some doc string added, but there is one change of substance made (in two places): the change that "fixes" the problem in renderers. That is, the "fix" is to the tests, to accept the new behavior of renderrs, not to the ported code, which makes thetesthtml
andanonhtml
fixtures bind theHTTP_ACCEPT
environment variable totext/html
rather than leaving it unbound (and effectively leaving to chance). It seems clear that these fixtures should expressly bindHTTP_ACCEPT
to the content they want, and if anyone wants something different we could create fixturestest_any
andanon_any
or something like that to test those cases as well, but we have never previously distinguished those cases. Probably we should add some renderers tests of those at some point.Move ORDER definition from
src/encoded/tests/datafixtures.py
tosrc/encoded/tests/conftest_settings.py
because it needs to be importable and one does not want to import the fixtures that are preloaded inpytest.ini
. That seems to create some problem for PyTest. Doing this change meant several test files had to change to importORDER
fromconftest_settings.py
instead.Changed test_indexing to use
es_app_settings
instead ofapp_settings
. Because fo complicated reasons to do with the name-overriding of fixtures, I had to leave it calledapp
, but that's whatcgap-portal
. I think is probably all part of the original port Will did there.Opportunistic:
Makefile
these changes were made that I think are pretty non-controversial:psql-test
and reimplementpsql-dev
. These now work through new filescripts/psql-start
.make kibana-start-test
and reimplementmake kibana-start
. These work through a revisedscripts/kibana-start
.make test-performance
andmake test
integration`.make test-unit
andmake test-npm
so thatunit
goes first when doingmake test
on a local machine for development. (This does not affect the parallel way that testing works on GitHub Actions.)make retest
. I'm still not sure this works well enough to be of value, butpytest
says it's supposed to, so I want to hang onto it for a while as we do upgrades to newer versions ofpytest
where it might work better. It would be really useful if it worked as advertised.