Skip to content

Commit

Permalink
Merge pull request #62 from nschloe/pc
Browse files Browse the repository at this point in the history
some updates
  • Loading branch information
nschloe authored Oct 13, 2021
2 parents 16ba02a + bbdcb45 commit 0d32213
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest]
python-version: ["3.6", "3.7", "3.8", "3.9"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
include:
- platform: macos-latest
python-version: "3.9"
- platform: windows-latest
python-version: "3.9"

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/setup-python@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ repos:
language_version: python3

- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
rev: 4.0.1
hooks:
- id: flake8
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ default:

tag:
@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
curl -H "Authorization: token `cat ~/.github-access-token`" -d '{"tag_name": "{{version}}"}' https://api.github.com/repos/nschloe/{{name}}/releases
curl -H "Authorization: token `cat ~/.github-access-token`" -d '{"tag_name": "v{{version}}"}' https://api.github.com/repos/nschloe/{{name}}/releases

upload: clean
@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
Expand Down
7 changes: 3 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pytest-codeblocks
version = 0.11.3
version = 0.11.4
author = Nico Schlömer
author_email = nico.schloemer@gmail.com
description = Test code blocks in your READMEs
Expand All @@ -20,19 +20,18 @@ classifiers =
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10

[options]
package_dir =
=src
packages = find:
install_requires =
dataclasses;python_version<"3.7"
pytest >=6
python_requires = >=3.6
python_requires = >=3.7

[options.packages.find]
where=src
Expand Down
9 changes: 5 additions & 4 deletions src/pytest_codeblocks/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import contextlib
import re
import sys
Expand All @@ -7,20 +9,19 @@
from dataclasses import dataclass
from io import StringIO
from pathlib import Path
from typing import Optional, Union


@dataclass
class CodeBlock:
code: str
lineno: int
syntax: Optional[str] = None
expected_output: Optional[str] = None
syntax: str | None = None
expected_output: str | None = None
expect_exception: bool = False


def extract_from_file(
f: Union[str, bytes, Path], encoding: Optional[str] = "utf-8", *args, **kwargs
f: str | bytes | Path, encoding: str | None = "utf-8", *args, **kwargs
):
with open(f, encoding=encoding) as handle:
return extract_from_buffer(handle, *args, **kwargs)
Expand Down

0 comments on commit 0d32213

Please sign in to comment.