Was using os.urandom instead of self.urandom. Difference only matters for tests.