Not 100% sure of why this fixes the issue - it appears that changes to django.test.TestCase in Django 2.0 led to the test failing.
The command works correctly when run, but for some reason is having issues through the test (which uses call_command). The issue does not appear to be related to Django 2.0's changes to the call_command method.