diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba452c5..bad296f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9"] + python-version: ["3.7", "3.8", "3.9", "3.10"] os: ["ubuntu-latest", "macos-latest", "windows-latest"] steps: @@ -61,12 +61,10 @@ jobs: python -m site python -m pip install --upgrade pip setuptools wheel pip install -r requirements.txt - pip install nose coveralls + pip install -r requirements-dev.txt - name: Run tests - run: | - python -m nose --with-coverage --cover-package markovify test - python -m coverage html + run: make tests - name: Upload code coverage uses: codecov/codecov-action@v1.0.12 diff --git a/Makefile b/Makefile index 962b4f7..a76557b 100644 --- a/Makefile +++ b/Makefile @@ -4,13 +4,12 @@ venv: python3 -m venv venv requirements: - . venv/bin/activate pip install --upgrade pip pip install -r requirements-dev.txt pip install -e . tests: - python -m nose --with-coverage --cover-package markovify test + python -m pytest test python -m coverage html check-black: diff --git a/README.md b/README.md index 171644a..600172d 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Some reasons: - Relies only on pure-Python libraries, and very few of them. -- Tested on Python 3.6, 3.7, 3.8, and 3.9. +- Tested on Python 3.7, 3.8, 3.9, and 3.10. ## Installation diff --git a/requirements-dev.txt b/requirements-dev.txt index c1e6eaa..95c23a4 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ black flake8 -nose +pytest +pytest-cov coveralls diff --git a/setup.cfg b/setup.cfg index 8983a73..0d1f069 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,14 +2,10 @@ # max-complexity = 10 max-line-length = 88 ignore = - E203 # https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html?highlight=slices#slices - W503 # Impossible to obey both W503 and W504 + # https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html?highlight=slices#slices + E203, + # Impossible to obey both W503 and W504 + W503 -[tox] -envlist = py36,py37,py38,py39 -toxworkdir={env:TOX_WORK_DIR:.tox} - -[testenv] -deps= - -r requirements-dev.txt -commands=nosetests --with-coverage --cover-package markovify test +[tool:pytest] +addopts=--cov=markovify --cov-report xml:coverage.xml --cov-report term diff --git a/test/test_basic.py b/test/test_basic.py index 5f43f15..506a483 100644 --- a/test/test_basic.py +++ b/test/test_basic.py @@ -142,7 +142,8 @@ def test_min_words(self): def test_newline_text(self): with open( - os.path.join(os.path.dirname(__file__), "texts/senate-bills.txt") + os.path.join(os.path.dirname(__file__), "texts/senate-bills.txt"), + encoding="utf-8", ) as f: model = markovify.NewlineText(f.read()) model.make_sentence() diff --git a/test/test_itertext.py b/test/test_itertext.py index 8c85fd8..3284767 100644 --- a/test/test_itertext.py +++ b/test/test_itertext.py @@ -13,7 +13,8 @@ def test_simple(self): def test_without_retaining(self): with open( - os.path.join(os.path.dirname(__file__), "texts/senate-bills.txt") + os.path.join(os.path.dirname(__file__), "texts/senate-bills.txt"), + encoding="utf-8", ) as f: senate_model = markovify.Text(f, retain_original=False) sent = senate_model.make_sentence() @@ -22,7 +23,8 @@ def test_without_retaining(self): def test_from_json_without_retaining(self): with open( - os.path.join(os.path.dirname(__file__), "texts/senate-bills.txt") + os.path.join(os.path.dirname(__file__), "texts/senate-bills.txt"), + encoding="utf-8", ) as f: original_model = markovify.Text(f, retain_original=False) d = original_model.to_json() @@ -37,7 +39,10 @@ def test_from_mult_files_without_retaining(self): os.path.join(os.path.dirname(__file__), "texts") ): for filename in filenames: - with open(os.path.join(dirpath, filename)) as f: + with open( + os.path.join(dirpath, filename), + encoding="utf-8", + ) as f: models.append(markovify.Text(f, retain_original=False)) combined_model = markovify.combine(models) sent = combined_model.make_sentence()