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

test on Python 3.11 and pypy #2

Merged
merged 3 commits into from
Jun 28, 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
13 changes: 12 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ jobs:
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
pyv: ['3.8', '3.9', '3.10']
nox_session: [""]
include:
- os: ubuntu-latest
pyv: 'pypy-3.8'
- os: ubuntu-latest
pyv: '3.11-dev'
nox_session: 'tests-3.11'

steps:
- name: Check out the repository
Expand All @@ -40,10 +47,14 @@ jobs:
nox --version

- name: Lint code and check dependencies
if: matrix.pyv != '3.11-dev'
run: nox -s lint safety

- name: Run tests
run: nox -s tests-${{ matrix.pyv }} -- --cov-report=xml
run: nox -s $TEST_SESSION -- --cov-report=xml
shell: bash
env:
TEST_SESSION: ${{ matrix.nox_session || format('tests-{0}', matrix.pyv) }}

- name: Upload coverage report
uses: codecov/codecov-action@v3.1.0
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
locations = "src", "tests"


@nox.session(python=["3.8", "3.9", "3.10"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "pypy-3.8", "pypy-3.9"])
def tests(session: nox.Session) -> None:
session.install(".[tests]")
session.run(
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Development Status :: 4 - Beta

[options]
Expand Down
15 changes: 8 additions & 7 deletions tests/test_memfs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
from os import fspath
from unittest.mock import ANY

import pytest
Expand Down Expand Up @@ -33,14 +33,15 @@ def test_strip(m):
assert m._strip_protocol("/b/c/") == "/b/c"


def test_put_single(m, tmpdir):
fn = os.path.join(str(tmpdir), "dir")
os.mkdir(fn)
open(os.path.join(fn, "abc"), "w").write("text")
m.put(fn, "/test") # no-op, no files
def test_put_single(m, tmp_path):
fn = tmp_path / "dir"
fn.mkdir()

(fn / "abc").write_bytes(b"text")
m.put(fspath(fn), "/test") # no-op, no files
assert not m.exists("/test/abc")
assert not m.exists("/test/dir")
m.put(fn + "/", "/test", recursive=True)
m.put(fspath(fn), "/test", recursive=True)
assert m.cat("/test/abc") == b"text"


Expand Down