From b358c78bdf50c783be4d771f911628927e001ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20F=C3=A9lizard?= Date: Mon, 9 Sep 2024 05:33:28 +0000 Subject: [PATCH] WIP --- .github/workflows/zeyple.yml | 10 ++++++---- tests/test_zeyple.py | 4 ++++ zeyple/zeyple.py | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zeyple.yml b/.github/workflows/zeyple.yml index 8f65669..263933b 100644 --- a/.github/workflows/zeyple.yml +++ b/.github/workflows/zeyple.yml @@ -28,16 +28,18 @@ jobs: sudo apt-get install debconf-utils sudo debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Local only'" sudo debconf-set-selections <<< "postfix postfix/mailname string localhost" - sudo apt-get install -y mailutils ruby ruby-dev rubygems build-essential sudo gnupg python3-gpg + sudo apt-get install -y mailutils ruby ruby-dev rubygems build-essential sudo gnupg python3-gpg libgpgme11 libgpgme-dev sudo gem install --no-document fpm python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox + python -m pip install --upgrade mock pycodestyle pytest pytest-cov - name: Build deb package run: ./fpm/create - name: End to end test using deb package run: sudo bash -ex ./tests/e2e.sh - - name: Test with tox - run: tox + - name: Lint with pycodestyle + run: pycodestyle --show-pep8 --max-line-length=100 + - name: Test with pytest + run: env PYTHONPATH=$PYTHONPATH:/usr/lib/python3/dist-packages python -m pytest --cov=zeyple/ --cov-report=html - name: Upload deb package uses: actions/upload-artifact@v1 with: diff --git a/tests/test_zeyple.py b/tests/test_zeyple.py index a724d41..0ac04a6 100644 --- a/tests/test_zeyple.py +++ b/tests/test_zeyple.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from __future__ import absolute_import, print_function, unicode_literals + from configparser import ConfigParser from textwrap import dedent from unittest.mock import Mock @@ -14,6 +16,8 @@ from zeyple import zeyple as z +del absolute_import, print_function, unicode_literals + KEYS_FNAME = os.path.join(os.path.dirname(__file__), 'keys.gpg') TEST1_ID = 'D6513C04E24C1F83' TEST1_EMAIL = 'test1@zeyple.example.com' diff --git a/zeyple/zeyple.py b/zeyple/zeyple.py index 8b14b3c..04863a7 100755 --- a/zeyple/zeyple.py +++ b/zeyple/zeyple.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from __future__ import absolute_import, print_function, unicode_literals + from configparser import ConfigParser from io import BytesIO import copy @@ -15,6 +17,8 @@ import smtplib import sys +del absolute_import, print_function, unicode_literals + def message_from_binary(message): return email.message_from_bytes(message)