def test_not_set_subset_X(matrix_type, subset_func):
    adata = ad.AnnData(matrix_type(asarray(sparse.random(20, 20))))
    init_hash = joblib.hash(adata)
    orig_X_val = adata.X.copy()
    while True:
        subset_idx = slice_subset(adata.obs_names)
        if len(adata[subset_idx, :]) > 2:
            break
    subset = adata[subset_idx, :]

    subset = adata[:, subset_idx]

    internal_idx = _normalize_index(
        subset_func(np.arange(subset.X.shape[1])), subset.var_names
    )
    assert subset.is_view
    subset.X[:, internal_idx] = 1
    assert not subset.is_view
    assert not np.any(asarray(adata.X != orig_X_val))

    assert init_hash == joblib.hash(adata)
def commit_and_push(repo_dir, day):
    subprocess.check_call(
        ["git", "config", "--global", "user.email", "u1test+m-o@canonical.com"]
    )
    subprocess.check_call(["git", "config", "--global", "user.name", "snappy-m-o"])

    subprocess.check_call(["git", "-C", repo_dir, "add", "--all"])
    subprocess.check_call(
        [
            "git",
            "-C",
            repo_dir,
            "commit",
            "--message",
            "Add the results for {}".format(day),
        ]
    )

    subprocess.check_call(
        [
            "git",
            "-C",
            repo_dir,
            "push",
            "https://{GH_TOKEN}@github.com/elopio/autopkgtest-results.git".format(
                GH_TOKEN=os.environ.get("GH_TOKEN_PPA_AUTOPKGTEST_RESULTS")
            ),
        ]
    )