Commit d637ac60 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][utils] Add random id generator

parent befb6184
......@@ -30,6 +30,8 @@
import os
import shutil
import string
import random
import nose
......@@ -161,3 +163,13 @@ def cleanup():
shutil.copymode(tmp_prefix, tmp_prefix + '.new')
shutil.rmtree(tmp_prefix)
shutil.move(tmp_prefix + '.new', tmp_prefix)
#----------------------------------------------------------
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
""" Simple id generator based on
https://stackoverflow.com/a/2257449/5843716
"""
return ''.join(random.choice(chars) for _ in range(size))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment