Skip to content

Commit

Permalink
Merge pull request #2 from iterative/311
Browse files Browse the repository at this point in the history
test on Python 3.11 and pypy
  • Loading branch information
skshetry authored Jun 28, 2022
2 parents 48c0bcc + a24e983 commit 135eeb2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
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/[email protected]
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

0 comments on commit 135eeb2

Please sign in to comment.