Yep, this is fine.  Normally we like to avoid using globals, but for unittests it's fine.  It's also okay to not do full comments/docstrings and perfect formatting.  Our quality standards for unittests are a bit lower (assuming there are no major logic problems and such).