From c4ad06d770bf568c0870efe4c2f7bbac9678c349 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Wed, 7 Aug 2024 12:22:53 +0200 Subject: [PATCH] finish to replace Nose with Pytest --- .github/workflows/test.yml | 2 +- .gitignore | 1 - requirements.txt | 2 +- setup.py | 3 +-- tests.py | 5 ++--- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3c7b97a..f3e22e6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install gevent requests pytest nose + python -m pip install gevent requests pytest - name: Test with pytest run: | pytest tests.py diff --git a/.gitignore b/.gitignore index 624f4a6..de91e13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ .coverage MANIFEST coverage.xml -nosetests.xml junit-report.xml pylint.txt toy.py diff --git a/requirements.txt b/requirements.txt index ebe8eeb..c807cc8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ requests gevent -nose +pytest diff --git a/setup.py b/setup.py index 0343841..7743efd 100644 --- a/setup.py +++ b/setup.py @@ -44,8 +44,7 @@ 'gevent', 'requests' ], - tests_require = ['nose'], - test_suite = 'nose.collector', + tests_require = ['pytest'], py_modules=['grequests'], zip_safe=False, include_package_data=True, diff --git a/tests.py b/tests.py index 8d500ce..081c9b3 100644 --- a/tests.py +++ b/tests.py @@ -2,7 +2,6 @@ # -*- coding: utf-8 -*- from grequests import get, map, imap -from nose.tools import ok_ ########### Constants ############ urls = [ @@ -16,14 +15,14 @@ def test_get(): to_fetch = (get(url) for url in urls) map(to_fetch) for fetched in to_fetch: - ok_(fetched.ok, True) + assert fetched.ok def test_imap_with_size(): global urls to_fetch = (get(url) for url in urls) imap(to_fetch, size = len(urls) - 1) for fetching in to_fetch: - ok_(fetching.send(), True) + assert fetching.send() import os import time