Skip to content

Commit 5ec75ac

Browse files
committed
Fix GitHub workflow
1 parent c1c184a commit 5ec75ac

File tree

5 files changed

+31
-33
lines changed

5 files changed

+31
-33
lines changed

.github/workflows/zeyple.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: [2.7, 3.7]
16+
python-version: [3.11, 3.12]
1717
fail-fast: false
1818
steps:
1919
- name: Checkout repository
20-
uses: actions/checkout@v1
20+
uses: actions/checkout@v4
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v1
22+
uses: actions/setup-python@v5
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies
@@ -28,16 +28,16 @@ jobs:
2828
sudo apt-get install debconf-utils
2929
sudo debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Local only'"
3030
sudo debconf-set-selections <<< "postfix postfix/mailname string localhost"
31-
sudo apt-get install -y mailutils ruby ruby-dev rubygems build-essential sudo gnupg python-gpg libgpgme-dev swig
32-
python -m pip install --upgrade pip
33-
pip install -r requirements_gpg.txt
31+
sudo apt-get install -y mailutils ruby ruby-dev rubygems build-essential sudo gnupg python3-gpg
3432
sudo gem install --no-document fpm
35-
- name: Test
36-
run: python -m pytest tests/
33+
python -m pip install --upgrade pip setuptools wheel
34+
python -m pip install --upgrade tox
3735
- name: Build deb package
3836
run: ./fpm/create
3937
- name: End to end test using deb package
4038
run: sudo bash -ex ./tests/e2e.sh
39+
- name: Test with tox
40+
run: env CI=0 tox
4141
- name: Upload deb package
4242
uses: actions/upload-artifact@v1
4343
with:

CONTRIBUTING.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ If you want to contribute, please:
1212
You will need the following development dependencies.
1313

1414
* Packages:
15-
* Arch Linux: `pacman -S python-gpgme`
16-
* Debian/Ubuntu: `apt-get install libgpgme-dev`
17-
* Fedora: `yum install gpgme-devel python-devel python3-devel`
18-
* Python eggs: `pip install -r requirements.txt`
15+
* Arch Linux: `pacman -S python-gpgme python-tox`
16+
* Debian/Ubuntu: `apt-get install python3-gpg tox`
17+
* Fedora: `yum install python3-devel gpgme-devel tox`
1918

2019
## Testing
2120

requirements.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/test_zeyple.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
from six.moves.configparser import ConfigParser
4+
from configparser import ConfigParser
55
from textwrap import dedent
66
from unittest.mock import Mock
7-
from zeyple import zeyple
87
import gpg
98
import os
109
import re
@@ -13,6 +12,8 @@
1312
import tempfile
1413
import unittest
1514

15+
from zeyple import zeyple as z
16+
1617
KEYS_FNAME = os.path.join(os.path.dirname(__file__), 'keys.gpg')
1718
TEST1_ID = 'D6513C04E24C1F83'
1819
TEST1_EMAIL = '[email protected]'
@@ -22,6 +23,7 @@
2223
TEST_EXPIRED_ID = 'ED97E21F1C7F1AC6'
2324
TEST_EXPIRED_EMAIL = '[email protected]'
2425

26+
2527
class ZeypleTest(unittest.TestCase):
2628
def setUp(self):
2729
self.tmpdir = tempfile.mkdtemp()
@@ -52,7 +54,7 @@ def setUp(self):
5254
stderr=open('/dev/null'),
5355
)
5456

55-
self.zeyple = zeyple.Zeyple(self.conffile)
57+
self.zeyple = z.Zeyple(self.conffile)
5658
self.zeyple._send_message = Mock() # don't try to send emails
5759

5860
def tearDown(self):
@@ -71,18 +73,19 @@ def assertValidMimeMessage(self, cipher_message, mime_message):
7173

7274
plain_payload = cipher_message.get_payload()
7375
encrypted_envelope = plain_payload[1]
74-
assert encrypted_envelope["Content-Type"] == 'application/octet-stream; name="encrypted.asc"'
76+
assert (encrypted_envelope["Content-Type"] ==
77+
'application/octet-stream; name="encrypted.asc"')
7578

7679
encrypted_payload = encrypted_envelope.get_payload().encode('utf-8')
7780
decrypted_envelope = self.decrypt(encrypted_payload).decode('utf-8').strip()
7881

79-
boundary = re.match(r'.+boundary="([^"]+)"', decrypted_envelope, re.MULTILINE | re.DOTALL).group(1)
82+
boundary = re.match(r'.+boundary="([^"]+)"',
83+
decrypted_envelope, re.MULTILINE | re.DOTALL).group(1)
8084
# replace auto-generated boundary with one we know
8185
mime_message = mime_message.replace("BOUNDARY", boundary)
8286

8387
prefix = dedent("""\
84-
Content-Type: multipart/mixed; boundary=\"""" + \
85-
boundary + """\"
88+
Content-Type: multipart/mixed; boundary=\"""" + boundary + """\"
8689
8790
""")
8891
mime_message = prefix + mime_message
@@ -237,7 +240,7 @@ def test_process_message_with_complex_message(self):
237240
with open(filename, 'r') as test_file:
238241
contents = test_file.read()
239242

240-
self.zeyple.process_message(contents, [TEST1_EMAIL]) # should not raise
243+
self.zeyple.process_message(contents, [TEST1_EMAIL]) # should not raise
241244

242245
def test_force_encryption(self):
243246
"""Tries to encrypt without key"""

tox.ini

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ skip_missing_interpreters = True
44
skipsdist = True
55

66
[testenv]
7-
deps = -rrequirements.txt
7+
deps =
8+
mock
9+
pycodestyle
10+
pytest
11+
pytest-cov
812
setenv =
9-
PYTHONPATH = {toxinidir}
13+
PYTHONPATH = {toxinidir}:/usr/lib/python3.12/site-packages/:/usr/lib/python3/dist-packages/
14+
#list_dependencies_command = python -m pip list
1015
commands =
11-
pycodestyle --show-pep8 zeyple
12-
py.test {posargs:--cov-report=html --cov=zeyple/}
16+
python -m pytest --cov=zeyple/ --cov-report=html
17+
pycodestyle --show-pep8 --max-line-length=100

0 commit comments

Comments
 (0)