__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import functools
import os
import shutil
import tempfile
from unittest import TestCase
class SubiTestCase(TestCase):
def tmp_dir(self, dir=None, cleanup=True):
# return a full path to a temporary directory that will be cleaned up.
if dir is None:
tmpd = tempfile.mkdtemp(
prefix="subiquity-%s." % self.__class__.__name__)
else:
tmpd = tempfile.mkdtemp(dir=dir)
self.addCleanup(functools.partial(shutil.rmtree, tmpd))
return tmpd
def tmp_path(self, path, dir=None):
# return an absolute path to 'path' under dir.
# if dir is None, one will be created with tmp_dir()
# the file is not created or modified.
if dir is None:
dir = self.tmp_dir()
return os.path.normpath(os.path.abspath(os.path.join(dir, path)))
def populate_dir(path, files):
if not os.path.exists(path):
os.makedirs(path)
ret = []
for (name, content) in files.items():
p = os.path.sep.join([path, name])
if not os.path.isdir(os.path.dirname(p)):
os.makedirs(os.path.dirname(p))
with open(p, "wb") as fp:
if isinstance(content, bytes):
fp.write(content)
else:
fp.write(content.encode('utf-8'))
fp.close()
ret.append(p)
return ret
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 1.34 KB | 0644 |
|
| mocks.py | File | 1.3 KB | 0644 |
|
| test_lsb_release.py | File | 2.14 KB | 0644 |
|
| test_netplan.py | File | 1.61 KB | 0644 |
|
| test_pubsub.py | File | 1.71 KB | 0644 |
|
| test_utils.py | File | 2.11 KB | 0644 |
|
| test_view.py | File | 3 KB | 0644 |
|
| util.py | File | 830 B | 0644 |
|