diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8617af..5f5eae7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ name: searx-instances -on: [push, pull_request] +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] jobs: build: diff --git a/Makefile b/Makefile index e7fe5d3..ffded4c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) install: - python -m pip install --upgrade pip + python -m pip install --upgrade pip wheel setuptools pip install -r requirements.txt install-update: diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..641c4b5 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +asyncio_mode = strict diff --git a/requirements-dev.txt b/requirements-dev.txt index 98d14bc..9714711 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ -pylint==2.8.3 -pytest==6.2.4 -pytest-asyncio==0.15.1 -pytest-cov==2.12.1 -flake8==3.9.2 +pylint==2.13.8 +pytest==7.1.2 +pytest-asyncio==0.18.3 +pytest-cov==3.0.0 +flake8==4.0.1 diff --git a/requirements-update.txt b/requirements-update.txt index ee5347e..7d09213 100644 --- a/requirements-update.txt +++ b/requirements-update.txt @@ -1,2 +1,2 @@ -httpx==0.18.1 -GitPython==3.1.17 +httpx==0.22.0 +GitPython==3.1.27 diff --git a/requirements.txt b/requirements.txt index ed964e6..40edc2e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -pyyaml==5.4.1 -rfc3986==1.5.0 +pyyaml==6.0 +rfc3986==2.0.0 diff --git a/searxinstances/__version__.py b/searxinstances/__version__.py index 487c85a..dfa27d9 100644 --- a/searxinstances/__version__.py +++ b/searxinstances/__version__.py @@ -1,3 +1,3 @@ __title__ = "searxinstances" __description__ = "SearXNG & searx instances." -__version__ = "0.0.2" +__version__ = "0.0.3" diff --git a/searxinstances/check.py b/searxinstances/check.py index bc108f9..9bae908 100644 --- a/searxinstances/check.py +++ b/searxinstances/check.py @@ -9,12 +9,13 @@ def run_instance_diff(content_after: str): with tempfile.NamedTemporaryFile(delete=False) as tmpfile: tmpfile.write(content_after) tmpfile.flush() - subprocess.Popen(['diff', tmpfile.name, model.FILENAME]) + with subprocess.Popen(['diff', tmpfile.name, model.FILENAME]): + pass def check(): print(f'Checking {model.FILENAME}') - with open(model.FILENAME, 'r') as input_file: + with open(model.FILENAME, 'r', encoding='utf-8') as input_file: content = input_file.read() instance_list = model.yaml_load(content) content_after = model.yaml_dump(instance_list) diff --git a/searxinstances/model.py b/searxinstances/model.py index bdd4abe..a9c617a 100644 --- a/searxinstances/model.py +++ b/searxinstances/model.py @@ -228,7 +228,7 @@ def yaml_load(content: str) -> InstanceList: def load(filename: str = FILENAME) -> InstanceList: - with open(filename, 'r') as input_file: + with open(filename, 'r', encoding='utf-8') as input_file: instance_list = yaml.load(input_file, Loader=ILLoader) assert isinstance(instance_list, InstanceList) return instance_list @@ -236,7 +236,7 @@ def load(filename: str = FILENAME) -> InstanceList: def save(instance_list: InstanceList, filename: str = FILENAME): output_content = yaml_dump(instance_list) - with open(filename, 'w') as output_file: + with open(filename, 'w', encoding='utf-8') as output_file: output_file.write(output_content) diff --git a/searxinstances/utils/editor.py b/searxinstances/utils/editor.py index cc05f5a..21579d7 100644 --- a/searxinstances/utils/editor.py +++ b/searxinstances/utils/editor.py @@ -67,9 +67,9 @@ def get_editor_args(editor): def get_default_editors(): sys_platform = sys.platform - for platform in EDITORS: + for platform, editor in EDITORS.items(): if sys_platform.startswith(platform): - return EDITORS[platform] + return editor return COMMON_EDITORS