From 7d617ff9dddee73bde86b79c9aa2f1c98f19e339 Mon Sep 17 00:00:00 2001 From: Benjamin Greiner Date: Sun, 16 Aug 2020 20:17:39 +0200 Subject: [PATCH 1/3] add 2 basic unit tests --- certifi/tests/__init__.py | 2 ++ certifi/tests/test_certify.py | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 certifi/tests/__init__.py create mode 100755 certifi/tests/test_certify.py diff --git a/certifi/tests/__init__.py b/certifi/tests/__init__.py new file mode 100644 index 00000000..a2951af7 --- /dev/null +++ b/certifi/tests/__init__.py @@ -0,0 +1,2 @@ +# certify.tests module + diff --git a/certifi/tests/test_certify.py b/certifi/tests/test_certify.py new file mode 100755 index 00000000..8e5699e7 --- /dev/null +++ b/certifi/tests/test_certify.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +""" +unit tests to make sure everything behaves as expected +""" + +import os +import unittest + +import certifi + + +class TestCertifi(unittest.TestCase): + + def test_cabundle_exists(self): + """Check that the reported bundle exists""" + assert os.path.exists(certifi.where()) + + def test_read_contents(self): + content = certifi.contents() + assert "-----BEGIN CERTIFICATE-----" in content From 0f5d95efc28334ea53ef97d96858794ef5fc633d Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Sun, 16 Aug 2020 20:22:37 +0200 Subject: [PATCH 2/3] Add Github workflow for pytest run --- .github/workflows/python-package.yml | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 00000000..6962bef0 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,40 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.5, 3.6, 3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + # pip install flake8 pytest + # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + #- name: Lint with flake8 + # run: | + # # stop the build if there are Python syntax errors or undefined names + # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From fc74286112c1a36724ab11d6f7c87d41fb178c54 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 25 Nov 2020 08:50:17 -0500 Subject: [PATCH 3/3] Various cleanups --- .github/workflows/ci.yml | 27 +++++++++++++++++++ .github/workflows/python-package.yml | 40 ---------------------------- MANIFEST.in | 3 +++ certifi/tests/__init__.py | 2 -- certifi/tests/test_certify.py | 5 ---- 5 files changed, 30 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..84496648 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: CI + +on: + push: + branches: [master] + pull_request: {} + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + - name: Test with pytest + run: | + pytest diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index 6962bef0..00000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,40 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.5, 3.6, 3.7, 3.8] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install test dependencies - run: | - python -m pip install --upgrade pip - pip install pytest - # pip install flake8 pytest - # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - #- name: Lint with flake8 - # run: | - # # stop the build if there are Python syntax errors or undefined names - # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest diff --git a/MANIFEST.in b/MANIFEST.in index 6077b5ff..cb2f4509 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,4 @@ include MANIFEST.in README.rst LICENSE certifi/cacert.pem + +exclude .github/ +recursive-exclude .github \ No newline at end of file diff --git a/certifi/tests/__init__.py b/certifi/tests/__init__.py index a2951af7..e69de29b 100644 --- a/certifi/tests/__init__.py +++ b/certifi/tests/__init__.py @@ -1,2 +0,0 @@ -# certify.tests module - diff --git a/certifi/tests/test_certify.py b/certifi/tests/test_certify.py index 8e5699e7..7fb8c77f 100755 --- a/certifi/tests/test_certify.py +++ b/certifi/tests/test_certify.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -""" -unit tests to make sure everything behaves as expected -""" import os import unittest @@ -10,9 +7,7 @@ class TestCertifi(unittest.TestCase): - def test_cabundle_exists(self): - """Check that the reported bundle exists""" assert os.path.exists(certifi.where()) def test_read_contents(self):