Skip to content

Fix codecov #70

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

Closed
wants to merge 5 commits into from
Closed
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
10 changes: 8 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
version: 2
version: 2.1

orbs:
codecov: codecov/[email protected]

jobs:
build:
docker:
Expand Down Expand Up @@ -27,9 +31,11 @@ jobs:
# Run setup.py so that the version is defined
python3 setup.py build
python3 -m pytest --cov=tszip --cov-report=xml --cov-branch -n 2 tests
codecov
rm .coverage

- codecov/upload:
token: CODECOV_TOKEN

- run:
name: Build Python package
command: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ on:
jobs:
pre-commit:
name: Lint
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/action@v3.0.0

test:
name: Python
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: [ 3.7, 3.9 ]
python: [ 3.8, "3.10" ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
defaults:
run:
Expand All @@ -48,7 +48,7 @@ jobs:
/usr/share/miniconda/envs/anaconda-client-env
~/osx-conda
~/.profile
key: ${{ runner.os }}-${{ matrix.python}}-conda-v10-${{ hashFiles('requirements/CI-tests-conda.txt') }}
key: ${{ runner.os }}-${{ matrix.python}}-conda-v12-${{ hashFiles('requirements/CI-tests-conda.txt') }}

- name: Install Conda
uses: conda-incubator/setup-miniconda@v2
Expand Down
1 change: 0 additions & 1 deletion .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pull_request_rules:
queue:
name: default
method: rebase
rebase_fallback: none
update_method: rebase

- name: Remove label after merge
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: mixed-line-ending
- id: check-case-conflict
- id: check-yaml
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.4.0
rev: v3.9.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/asottile/pyupgrade
rev: v2.12.0
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py3-plus, --py36-plus]
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 23.3.0
hooks:
- id: black
language_version: python3
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.1
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--config=.flake8]
Expand Down
2 changes: 1 addition & 1 deletion requirements/CI-tests-conda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ msprime==1.1.0
pytest==6.2.5
pytest-cov==3.0.0
pytest-xdist==2.5.0
tskit==0.4.1
tskit==0.5.4
zarr==2.10.3
1 change: 0 additions & 1 deletion requirements/development.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
codecov
coverage
flake8
h5py
Expand Down
9 changes: 4 additions & 5 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,10 @@ def test_bad_file_format(self):
with self.assertRaises(TestException):
self.run_tszip([str(self.trees_path)])
mocked_exit.assert_called_once_with(
f"Error loading '{self.trees_path}': File not in kastore format. If this"
f" file was generated by msprime < 0.6.0 (June 2018) it uses the old"
f" HDF5-based format which can no longer be read directly. Please"
f" convert to the new kastore format using the ``tskit upgrade``"
f" command."
f"Error loading '{self.trees_path}': File not in kastore format. Either"
f" the file is corrupt or it is not a tskit tree sequence file. It may"
f" be a legacy HDF file upgradable with `tskit upgrade` or a compressed"
f" tree sequence file that can be decompressed with `tszip`."
)

def test_compress_stdout_keep(self):
Expand Down
12 changes: 6 additions & 6 deletions tests/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,36 +57,36 @@ def test_int16(self):
self.verify(
np.int16,
np.array(
[2 ** 15 - 1, -(2 ** 15) + 1, 2 ** 7 + 1, -(2 ** 7) - 1], dtype=np.int64
[2**15 - 1, -(2**15) + 1, 2**7 + 1, -(2**7) - 1], dtype=np.int64
),
)

def test_uint16(self):
self.verify(np.uint16, np.array([256, 2 ** 16 - 1], dtype=np.uint64))
self.verify(np.uint16, np.array([256, 2**16 - 1], dtype=np.uint64))

def test_int32(self):
self.verify(
np.int32,
np.array(
[2 ** 31 - 1, -(2 ** 31) + 1, 2 ** 15 + 1, -(2 ** 15) - 1],
[2**31 - 1, -(2**31) + 1, 2**15 + 1, -(2**15) - 1],
dtype=np.int64,
),
)

def test_uint32(self):
self.verify(np.uint32, np.array([2 ** 16 + 1, 2 ** 32 - 1], dtype=np.uint64))
self.verify(np.uint32, np.array([2**16 + 1, 2**32 - 1], dtype=np.uint64))

def test_int64(self):
self.verify(
np.int64,
np.array(
[2 ** 63 - 1, -(2 ** 63) + 1, 2 ** 31 + 1, -(2 ** 31) - 1],
[2**63 - 1, -(2**63) + 1, 2**31 + 1, -(2**31) - 1],
dtype=np.int64,
),
)

def test_uint64(self):
self.verify(np.uint64, np.array([2 ** 32 + 1, 2 ** 64 - 1], dtype=np.uint64))
self.verify(np.uint64, np.array([2**32 + 1, 2**64 - 1], dtype=np.uint64))

def test_float32(self):
self.verify(np.float32, np.array([0.1, 1e-3], dtype=np.float32))
Expand Down
3 changes: 1 addition & 2 deletions tszip/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def compress(ts, destination, variants_only=False):
else:
# Assume that destination is a file-like object open in "wb" mode.
with open(filename, "rb") as source:
chunk_size = 2 ** 10 # 1MiB
chunk_size = 2**10 # 1MiB
for chunk in iter(functools.partial(source.read, chunk_size), b""):
destination.write(chunk)

Expand Down Expand Up @@ -167,7 +167,6 @@ def compress(self, root, compressor):


def compress_zarr(ts, root, variants_only=False):

provenance_dict = provenance.get_provenance_dict({"variants_only": variants_only})

if variants_only:
Expand Down