def handle(self, *args, **kwargs):
        month = now() - relativedelta(months=1)  # determine one month ago
        users = list(User.objects.annotate(num_articles=Count('article')).filter(num_articles=0, last_login__lte=month))
        for user in users:
            user.delete()
            self.stdout.write('User "%s" deleted.' % user)
        self.stdout.write("%d user(s) deleted." % len(users))
Test to run against the server as a normal luigi invocation does
dataset/ETHPy150Open 2buntu/2buntu-blog/twobuntu/accounts/management/commands/cleanusers.py/Command.handle--crossover with--dataset/ETHPy150Open spotify/luigi/test/server_test.py/_INETServerTest.test_with_cmdline