mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Don't create a new domain at each test
This commit is contained in:
parent
1c1b88e455
commit
83a97798a0
1 changed files with 10 additions and 1 deletions
|
@ -79,12 +79,13 @@ def clean_user_groups_permission():
|
||||||
|
|
||||||
def setup_function(function):
|
def setup_function(function):
|
||||||
clean_user_groups_permission()
|
clean_user_groups_permission()
|
||||||
markers = {m.name: {'args':m.args, 'kwargs':m.kwargs} for m in function.__dict__.get("pytestmark",[])}
|
|
||||||
|
|
||||||
global maindomain
|
global maindomain
|
||||||
global other_domains
|
global other_domains
|
||||||
maindomain = _get_maindomain()
|
maindomain = _get_maindomain()
|
||||||
|
|
||||||
|
markers = {m.name: {'args':m.args, 'kwargs':m.kwargs} for m in function.__dict__.get("pytestmark",[])}
|
||||||
|
|
||||||
if "other_domains" in markers:
|
if "other_domains" in markers:
|
||||||
other_domains = ["domain_%s.dev" % string.ascii_lowercase[number] for number in range(markers['other_domains']['kwargs']['number'])]
|
other_domains = ["domain_%s.dev" % string.ascii_lowercase[number] for number in range(markers['other_domains']['kwargs']['number'])]
|
||||||
for domain in other_domains:
|
for domain in other_domains:
|
||||||
|
@ -94,6 +95,8 @@ def setup_function(function):
|
||||||
# Dirty patch of DNS resolution. Force the DNS to 127.0.0.1 address even if dnsmasq have the public address.
|
# Dirty patch of DNS resolution. Force the DNS to 127.0.0.1 address even if dnsmasq have the public address.
|
||||||
# Mainly used for 'can_access_webpage' function
|
# Mainly used for 'can_access_webpage' function
|
||||||
dns_cache = {(maindomain, 443, 0, 1): [(2, 1, 6, '', ('127.0.0.1', 443))]}
|
dns_cache = {(maindomain, 443, 0, 1): [(2, 1, 6, '', ('127.0.0.1', 443))]}
|
||||||
|
for domain in other_domains:
|
||||||
|
dns_cache[(domain, 443, 0, 1)] = [(2, 1, 6, '', ('127.0.0.1', 443))]
|
||||||
def new_getaddrinfo(*args):
|
def new_getaddrinfo(*args):
|
||||||
try:
|
try:
|
||||||
return dns_cache[args]
|
return dns_cache[args]
|
||||||
|
@ -135,6 +138,12 @@ def teardown_function(function):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def teardown_module(module):
|
||||||
|
global other_domains
|
||||||
|
for domain in other_domains:
|
||||||
|
domain_remove(domain)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def check_LDAP_db_integrity_call():
|
def check_LDAP_db_integrity_call():
|
||||||
check_LDAP_db_integrity()
|
check_LDAP_db_integrity()
|
||||||
|
|
Loading…
Add table
Reference in a new issue