Skip to content

Commit

Permalink
Testing AzureBlobFileSystem anon value from env var
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Braga committed Feb 14, 2024
1 parent 538c40a commit 95c1870
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions adlfs/tests/test_spec.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import os
import datetime
import tempfile

import dask.dataframe as dd
import numpy as np
import pandas as pd
import pytest
from unittest import mock
from pandas.testing import assert_frame_equal

from adlfs import AzureBlobFile, AzureBlobFileSystem
Expand All @@ -26,6 +28,12 @@ def assert_almost_equal(x, y, threshold, prop_name=None):
def test_connect(storage):
AzureBlobFileSystem(account_name=storage.account_name, connection_string=CONN_STR)

def test_anon_env(storage):
with mock.patch.dict(os.environ, {"AZURE_STORAGE_ANON": "false"}):
AzureBlobFileSystem.cachable = False # Setting cachable to false to avoid re-testing the instance from the previous test
x = AzureBlobFileSystem(account_name=storage.account_name, connection_string=CONN_STR)
assert not x.anon
AzureBlobFileSystem.cachable = True # Restoring cachable value

def assert_blob_equals(blob, expected_blob):
irregular_props = [
Expand Down

0 comments on commit 95c1870

Please sign in to comment.