From 8bb45c19ef6626b43f3b17c530480e62814cf23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= Date: Tue, 6 Aug 2024 11:25:51 +0100 Subject: [PATCH] chore: major change in testing strategy, removed travis Made pytest the default testing in actions. --- .github/workflows/main.yml | 30 ++++++++++++++++++++++++++++-- .travis.yml | 29 ----------------------------- pytest.ini | 3 +++ 3 files changed, 31 insertions(+), 31 deletions(-) delete mode 100644 .travis.yml create mode 100644 pytest.ini diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 051d0a2..71d0db9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,10 +18,19 @@ jobs: latest, rc ] + adapter: ["tiny", "mongo"] runs-on: ubuntu-latest container: python:${{ matrix.python-version }} steps: - uses: actions/checkout@v4 + - run: | + curl -fsSL https://pgp.mongodb.com/server-7.0.asc | gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor + echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] http://repo.mongodb.org/apt/debian $(. /etc/os-release && echo "$VERSION_CODENAME")/mongodb-org/7.0 main" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list + apt-get update && apt-get install -y mongodb-org mongodb-org-server mongodb-org-database\ + mongodb-org-mongos mongodb-org-shell mongodb-org-tools && mkdir -p /data/db + if: matrix.adapter == 'mongo' + - run: mongod & + if: matrix.adapter == 'mongo' - run: python --version - run: | pip install -r requirements.txt @@ -35,16 +44,29 @@ jobs: pip install black black . --check if: matrix.python-version == '3.12' - - run: ADAPTER=tiny python setup.py test + - run: | + pip install pytest + ADAPTER=${{ matrix.adapter }} pytest + - run: ADAPTER=${{ matrix.adapter }} python setup.py test + if: matrix.python-version != '3.12' && matrix.python-version != 'latest' build-pypy: name: Build PyPy strategy: matrix: python-version: [2.7, 3.6] + adapter: ["tiny", "mongo"] runs-on: ubuntu-latest container: pypy:${{ matrix.python-version }} steps: - uses: actions/checkout@v4 + - run: | + curl -fsSL https://pgp.mongodb.com/server-7.0.asc | gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor + echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] http://repo.mongodb.org/apt/debian $(. /etc/os-release && echo "$VERSION_CODENAME")/mongodb-org/7.0 main" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list + apt-get update && apt-get install -y mongodb-org mongodb-org-server mongodb-org-database\ + mongodb-org-mongos mongodb-org-shell mongodb-org-tools && mkdir -p /data/db + if: matrix.adapter == 'mongo' + - run: mongod & + if: matrix.adapter == 'mongo' - run: pypy --version - run: | pip install -r requirements.txt @@ -58,4 +80,8 @@ jobs: pip install black black . --check if: matrix.python-version == '3.12' - - run: ADAPTER=tiny pypy setup.py test + - run: | + pip install pytest + ADAPTER=${{ matrix.adapter }} pytest + - run: ADAPTER=${{ matrix.adapter }} pypy setup.py test + if: matrix.python-version != '3.12' && matrix.python-version != 'latest' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 137a175..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -dist: trusty -language: python -python: - - "2.7" - - "3.4" - - "3.5" - - "3.6" - - "pypy3" -matrix: - include: - - python: 3.8 - dist: xenial - - python: pypy - dist: xenial - - python: pypy3 - dist: xenial -services: mongodb -before_install: - - pip install --upgrade pip setuptools -install: - - if [[ $TRAVIS_PYTHON_VERSION == pypy* ]]; then pip install "tinydb<4"; fi - - pip install "pymongo<3.13" - - pip install -r requirements.py2.txt - - if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then pip install coveralls; fi -env: - - PIP_TRUSTED_HOST="pypi.python.org pypi.org files.pythonhosted.org" ADAPTER=mongo - - PIP_TRUSTED_HOST="pypi.python.org pypi.org files.pythonhosted.org" ADAPTER=tiny -script: if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then coverage run --source=budy setup.py test; else python setup.py test; fi -after_success: if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then coveralls; fi diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..6c0c6a6 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +python_files = *.py +testpaths = src/budy/test