Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CI windows encoding #174

Merged
merged 7 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
black
flake8
nose
pytest
pytest-cov
coveralls
16 changes: 6 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion test/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 8 additions & 3 deletions test/test_itertext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down