installable package (#9)

* turn repo into installable package (pip install -e .)

* add hatchling build packend

* call it pytest-abra

* add pytest entrypoint, so that it gets loaded automatically if installed (and pytest is run)

* make fixtures optional, so that pytest can still be used in other context

* add cli script -> you can now directly run "pytest-abra" in console

Reviewed-on: local-it-infrastructure/e2e_tests#9
Co-authored-by: Daniel <d.brummerloh@gmail.com>
Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
Daniel 2023-12-07 11:32:01 +01:00 committed by dan
parent 4c5a470a70
commit 8685688698
33 changed files with 294 additions and 210 deletions

40
pytest_abra/utils.py Normal file
View file

@ -0,0 +1,40 @@
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from urllib.parse import urlunparse
@dataclass
class BaseUrl:
netloc: str
scheme: str = "https"
path: str = ""
params: str = ""
query: str = ""
fragment: str = ""
def get(self, path: str = ""):
return urlunparse((self.scheme, self.netloc, path, self.params, self.query, self.fragment))
def get_datetime_string() -> str:
current_datetime = datetime.now()
return current_datetime.strftime("%Y-%m-%d-%H-%M-%S")
def rmtree(root_dir: Path):
"""removes a folder with content recursively"""
if not root_dir.is_dir():
return
for child in root_dir.iterdir():
if child.is_dir():
rmtree(child)
else:
child.unlink()
root_dir.rmdir()
def make_url(domain: str) -> str:
"""adds 'http://' at the beginning of a string"""
return "https://" + domain