Skip to content

Commit d5d3699

Browse files
remove excess changes
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent db5bbea commit d5d3699

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

examples/experimental/sea_connector_test.py

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,90 +22,99 @@
2222
"test_sea_metadata",
2323
]
2424

25+
2526
def load_test_function(module_name: str) -> Callable:
2627
"""Load a test function from a module."""
2728
module_path = os.path.join(
28-
os.path.dirname(os.path.abspath(__file__)),
29-
"tests",
30-
f"{module_name}.py"
29+
os.path.dirname(os.path.abspath(__file__)), "tests", f"{module_name}.py"
3130
)
32-
31+
3332
spec = importlib.util.spec_from_file_location(module_name, module_path)
3433
module = importlib.util.module_from_spec(spec)
3534
spec.loader.exec_module(module)
36-
35+
3736
# Get the main test function (assuming it starts with "test_")
3837
for name in dir(module):
3938
if name.startswith("test_") and callable(getattr(module, name)):
4039
# For sync and async query modules, we want the main function that runs both tests
4140
if name == f"test_sea_{module_name.replace('test_sea_', '')}_exec":
4241
return getattr(module, name)
43-
42+
4443
# Fallback to the first test function found
4544
for name in dir(module):
4645
if name.startswith("test_") and callable(getattr(module, name)):
4746
return getattr(module, name)
48-
47+
4948
raise ValueError(f"No test function found in module {module_name}")
5049

50+
5151
def run_tests() -> List[Tuple[str, bool]]:
5252
"""Run all tests and return results."""
5353
results = []
54-
54+
5555
for module_name in TEST_MODULES:
5656
try:
5757
test_func = load_test_function(module_name)
5858
logger.info(f"\n{'=' * 50}")
5959
logger.info(f"Running test: {module_name}")
6060
logger.info(f"{'-' * 50}")
61-
61+
6262
success = test_func()
6363
results.append((module_name, success))
64-
64+
6565
status = "✅ PASSED" if success else "❌ FAILED"
6666
logger.info(f"Test {module_name}: {status}")
67-
67+
6868
except Exception as e:
6969
logger.error(f"Error loading or running test {module_name}: {str(e)}")
7070
import traceback
71+
7172
logger.error(traceback.format_exc())
7273
results.append((module_name, False))
73-
74+
7475
return results
7576

77+
7678
def print_summary(results: List[Tuple[str, bool]]) -> None:
7779
"""Print a summary of test results."""
7880
logger.info(f"\n{'=' * 50}")
7981
logger.info("TEST SUMMARY")
8082
logger.info(f"{'-' * 50}")
81-
83+
8284
passed = sum(1 for _, success in results if success)
8385
total = len(results)
84-
86+
8587
for module_name, success in results:
8688
status = "✅ PASSED" if success else "❌ FAILED"
8789
logger.info(f"{status} - {module_name}")
88-
90+
8991
logger.info(f"{'-' * 50}")
9092
logger.info(f"Total: {total} | Passed: {passed} | Failed: {total - passed}")
9193
logger.info(f"{'=' * 50}")
9294

95+
9396
if __name__ == "__main__":
9497
# Check if required environment variables are set
95-
required_vars = ["DATABRICKS_SERVER_HOSTNAME", "DATABRICKS_HTTP_PATH", "DATABRICKS_TOKEN"]
98+
required_vars = [
99+
"DATABRICKS_SERVER_HOSTNAME",
100+
"DATABRICKS_HTTP_PATH",
101+
"DATABRICKS_TOKEN",
102+
]
96103
missing_vars = [var for var in required_vars if not os.environ.get(var)]
97-
104+
98105
if missing_vars:
99-
logger.error(f"Missing required environment variables: {', '.join(missing_vars)}")
106+
logger.error(
107+
f"Missing required environment variables: {', '.join(missing_vars)}"
108+
)
100109
logger.error("Please set these variables before running the tests.")
101110
sys.exit(1)
102-
111+
103112
# Run all tests
104113
results = run_tests()
105-
114+
106115
# Print summary
107116
print_summary(results)
108-
117+
109118
# Exit with appropriate status code
110119
all_passed = all(success for _, success in results)
111120
sys.exit(0 if all_passed else 1)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# This file makes the tests directory a Python package

0 commit comments

Comments
 (0)