Skip to content

Commit

Permalink
FIX workaround legacy for 3.7 and dtype 3.9/3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
eboileau committed Nov 21, 2024
1 parent cafdc67 commit 88b943d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
exclude: # Python v3.7 does not support Apple Silicon ARM64
- python-version: "3.7"
os: macos-latest
include: # run legacy versions on Intel CPUs
- python-version: "3.7"
os: macos-13
steps:
- uses: actions/checkout@v3
- name: Create rpbp conda environment
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge,bioconda,defaults
Expand Down
15 changes: 9 additions & 6 deletions tests/regression/test_rpbp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
logger = logging.getLogger(__name__)


def to_df(filename):
args = {}
def to_df(filename, dtype=None):
kwargs = {}
if filename.endswith(".bed.gz") or filename.endswith(".tab.gz"):
args = {"sep": "\t"}
kwargs = {"sep": "\t"}
elif filename.endswith(".mtx.gz"):
args = {"sep": " ", "comment": "%", "header": None}
return pd.read_csv(filename, **args)
kwargs = {"sep": " ", "comment": "%", "header": None}
return pd.read_csv(filename, dtype=dtype, **kwargs)


# test output of `prepare-rpbp-genome`
Expand All @@ -35,10 +35,13 @@ def test_pipeline_part2(getf_pipeline):
# deterministic output - profiles should match exactly
profiles, periodics, predictions = getf_pipeline

dtype = {"position": "int64", "count": "int64", "type": "str", "length": "int64"}
for file, ref_file in profiles:
msg = f"[PROFILES] Comparing {file} and {ref_file}"
logger.info(msg)
pd.testing.assert_frame_equal(to_df(file), to_df(ref_file), check_exact=True)
pd.testing.assert_frame_equal(
to_df(file, dtype=dtype), to_df(ref_file, dtype=dtype), check_exact=True
)

# periodic-offsets - compare only the periodic lengths
for file, ref_file in periodics:
Expand Down

0 comments on commit 88b943d

Please sign in to comment.