~mgedmin/pyspacewar/master

Viewing all changes in revision 248.

  • Committer: Marius Gedminas
  • Date: 2016-09-22 06:03:19 UTC
  • Revision ID: git-v1:e8f599d8db4d244119562fbb8ee11cd7dc666cee
Force SDL_VIDEODRIVER=dummy for tests

Background: my tests rely on pygame.key.name(K_RCTRL) returning
something meaningful (like "right ctrl").  This function is a thin
wrapper around SDL_GetKeyName(), which looks up a key from a lookup
table.  That lookup table is not static for some reason in SDL 1.2,
and gets initialized by this call chain:

  SDL_KeyboardInit() called by
  SDL_StartEventLoop() called by
  SDL_VideoInit() called by
  SDL_InitSubSystem() called by
  PyGame_Video_AutoInit() called by
  pygame.init() called by
  pygame.tests.test_ui.setUp()

Now SDL_VideoInit() also initializes other things, like the SDL video
subsystem, for which it tries various backends (including X11, aalib and
caca).  This explains why the presence/absence/values of various
environment variables (DISPLAY/TERM) could make or break the tests, or
why it would suddenly and unexpectedly flash and clear the screen for
tox -e coverage.

By forcing a specific SDL video driver (dummy) we remove non-determinism
and hopefully the issue can rest.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: