SQLAlchemy 1.0 sets bindpararms to their default values when loading
lazy-loaded columns. This is in contrast to the 0.9 behaviour of
ignoring our incongruous bindparam alltogether.
So MultilangQuery is still broken, but now it breaks in the same way as before.
While we're here, set the correct param in one of the multilang tests. Not that
it matters.
This commit updates the tests to take advantage of some of py.test's
newer features. Requires py.test 2.3 or newer. Tested with 2.3.0 and
2.5.2.
Tests which were parametrized now use py.test's built-in
parametrization[1].
The session and lookup objects are now implemented as fixtures[2].
The media root is a fixture as well. Fixtures are automatically passed
to any function that expects them.
Since the session is now created in one place, it is now possible to
provide an engine URI on the command line when running py.test. Ditto
for the index directory. (But the environment variables still work of
course.)
Slow tests are now marked as such and not run unless the --all option is
given.
A couple media tests are marked as xfail (expected to fail) because they
are broken.
[1]: http://pytest.org/latest/parametrize.html
[2]: http://pytest.org/latest/fixture.html
The Column class accepts a 'doc' argument. Use it.
And while we're at it, make them all unicode strings.
Performed by the following sed script:
s/info=dict(description=u\?\("[^"]*"\))/doc=u\1/
s/info=dict(description=u\?\('[^']*'\))/doc=u\1/
s/\(\s*\)info=dict(description=u\?\("[^"]*"\), /\1doc=u\2,\n\1info=dict(/
s/\(\s*\)info=dict(description=u\?\('[^']*'\), /\1doc=u\2,\n\1info=dict(/
/info=dict(description=u\?\('[^']*'\),$/ {
s//doc=u\1,/
n
s/^\s*/&info=dict(/
}
- Add --media-root option (was half-supported already, but not accepted
on the command line).
- Don't test for Colosseum and XD graphics, since we have none.
- Acknowledge *-beta sprites.
No reason to instantiate every time as_html's called, is there?
Also, sessions use a markdown_extension attribute instead of
markdown_extension_class. The latter is only used to set the former when
the session is created (unless another markdown_extension_class is given,
of course).
Links such as []{pokemon:mewthree} can come from users, so they should not
crash the parser.
So, when an object is not found (or more than one is found), call
identifier_url() directly, instead of failing to get the object for
object_url(). Essentially, treat the link as having an unknown category
(like mechanic:, currently).
The test that check the pokédex descriptions updated so that only
links to known objects and "mechanic:" are allowed.
Linked-to objects aren't required to have identifiers now, so object_url()
in custom extensions might need to be changed.
The one in the test did, for example.
Previously, every single spline-pokedex request tacked another markdown
extension onto a global list in spline, making markdown processing just
a little bit slower over time. This is terrible.
Now we do something a little less crazy and a little more global. Wait,
is that less crazy or more?
All accessors now take a `root` arg, the root of the media tree.
Alternatively `root` can be a custom MediaFile subclass, which should allow
neat tricks like:
- Checking some kind of manifest to prevent stat() calls
- Custom properties of the file objects (e.g. for HTML <img> tags)
- Downloading the media on demand
Tests assume media is at pokedex/data/media, skip otherwise.
- the Session has a `pokedex_link_maker` property, whose `object_url`
method is used to make URLs in Markdown
- pokemon.names_table.name is now an ordinary Unicode column
- pokemon.name is a MarkdownString that is aware of the session and the
language the string is in
- pokemon.name_map is a dict-like association_proxy of the above
- move.effect works similarly, with transparent $effect_chance substitution
as before
A few tests of the accessors, along with a very dumb, long-running script
to ensure everything is in its proper place, and there's nothing but the
proper things.
For now it still finds some beta form cruft for Burmy, Pichu and Cherrim.