File tree Expand file tree Collapse file tree 6 files changed +14
-28
lines changed
Expand file tree Collapse file tree 6 files changed +14
-28
lines changed Original file line number Diff line number Diff line change 11import subprocess
2+ import pytest
23
34
5+ @pytest .mark .integration
6+ @pytest .fixture (scope = "session" , autouse = True )
47def check_for_otdfctl ():
5- # TODO Consider setting GRPC_ENFORCE_ALPN_ENABLED to false if issues arise
6- # original_env = os.environ.copy()
7- # original_env["GRPC_ENFORCE_ALPN_ENABLED"] = "false"
8+ """
9+ Ensure that the otdfctl command is available on the system.
10+
11+ This fixture runs once per test session (for integration tests) and raises
12+ an exception if the otdfctl command is not found.
13+ """
14+
15+ # TODO Consider setting GRPC_ENFORCE_ALPN_ENABLED to false as needed
16+ # test_env = os.environ.copy()
17+ # test_env["GRPC_ENFORCE_ALPN_ENABLED"] = "false"
818
919 # Check if otdfctl is available
1020 try :
1121 subprocess .run (
1222 ["otdfctl" , "--version" ],
1323 capture_output = True ,
1424 check = True ,
15- # env=original_env
25+ # env=test_env
1626 )
1727 except (subprocess .CalledProcessError , FileNotFoundError ):
1828 raise Exception (
Original file line number Diff line number Diff line change 1010import json
1111from pathlib import Path
1212from tests .config_pydantic import CONFIG_TDF
13- from tests .support_otdfctl import check_for_otdfctl
1413
1514
1615def test_cli_help ():
@@ -181,8 +180,6 @@ def test_cli_encrypt_integration():
181180 "OPENTDF_PLATFORM_URL must be set in config for integration tests"
182181 )
183182
184- check_for_otdfctl ()
185-
186183 # Create temporary directory for work
187184 with tempfile .TemporaryDirectory () as temp_dir :
188185 temp_path = Path (temp_dir )
Original file line number Diff line number Diff line change 88import json
99from pathlib import Path
1010from tests .config_pydantic import CONFIG_TDF
11- from tests .support_otdfctl import check_for_otdfctl
1211
1312# Fail fast if OPENTDF_PLATFORM_URL is not set
1413platform_url = CONFIG_TDF .OPENTDF_PLATFORM_URL
2019def test_otdfctl_encrypt_python_decrypt (collect_server_logs ):
2120 """Integration test that uses otdfctl for encryption and the Python CLI for decryption"""
2221
23- check_for_otdfctl ()
24-
2522 # Create temporary directory for work
2623 with tempfile .TemporaryDirectory () as temp_dir :
2724 temp_path = Path (temp_dir )
@@ -197,8 +194,6 @@ def test_otdfctl_encrypt_python_decrypt(collect_server_logs):
197194def test_otdfctl_encrypt_otdfctl_decrypt (collect_server_logs ):
198195 """Integration test that uses otdfctl for both encryption and decryption to verify roundtrip functionality"""
199196
200- check_for_otdfctl ()
201-
202197 # Create temporary directory for work
203198 with tempfile .TemporaryDirectory () as temp_dir :
204199 temp_path = Path (temp_dir )
Original file line number Diff line number Diff line change 1212import zipfile
1313import os
1414import sys
15- from tests .support_otdfctl import check_for_otdfctl
1615
1716original_env = os .environ .copy ()
1817original_env ["GRPC_ENFORCE_ALPN_ENABLED" ] = "false"
@@ -314,7 +313,6 @@ def _run_otdfctl_inspect(
314313@pytest .mark .integration
315314def test_otdfctl_encrypt (collect_server_logs ):
316315 """Integration test that uses otdfctl for encryption only and verifies the TDF can be inspected"""
317- check_for_otdfctl ()
318316
319317 # Create temporary directory for work
320318 with tempfile .TemporaryDirectory () as temp_dir :
@@ -373,7 +371,6 @@ def test_otdfctl_encrypt(collect_server_logs):
373371@pytest .mark .integration
374372def test_python_encrypt (collect_server_logs ):
375373 """Integration test that uses Python CLI for encryption only and verifies the TDF can be inspected"""
376- check_for_otdfctl ()
377374
378375 # Create temporary directory for work
379376 with tempfile .TemporaryDirectory () as temp_dir :
Original file line number Diff line number Diff line change 1111from tests .config_pydantic import CONFIG_TDF
1212import os
1313
14- from tests .support_otdfctl import check_for_otdfctl
1514
1615original_env = os .environ .copy ()
1716original_env ["GRPC_ENFORCE_ALPN_ENABLED" ] = "false"
@@ -28,8 +27,6 @@ def test_cli_decrypt_otdfctl_tdf():
2827 Test that the Python CLI can successfully decrypt TDF files created by otdfctl.
2928 """
3029
31- check_for_otdfctl ()
32-
3330 # Create temporary directory for work
3431 with tempfile .TemporaryDirectory () as temp_dir :
3532 temp_path = Path (temp_dir )
@@ -134,7 +131,6 @@ def test_otdfctl_decrypt_comparison(collect_server_logs):
134131 """
135132 Test comparative decryption between otdfctl and Python CLI on the same TDF.
136133 """
137- check_for_otdfctl ()
138134
139135 # Create temporary directory for work
140136 with tempfile .TemporaryDirectory () as temp_dir :
@@ -305,8 +301,6 @@ def test_otdfctl_encrypt_decrypt_roundtrip(collect_server_logs):
305301 Test complete encrypt-decrypt roundtrip using otdfctl to verify functionality.
306302 """
307303
308- check_for_otdfctl ()
309-
310304 # Create temporary directory for work
311305 with tempfile .TemporaryDirectory () as temp_dir :
312306 temp_path = Path (temp_dir )
Original file line number Diff line number Diff line change 1313 TDFReader ,
1414)
1515from tests .config_pydantic import CONFIG_TDF
16- from tests .support_otdfctl import check_for_otdfctl
1716
1817# Fail fast if OPENTDF_PLATFORM_URL is not set
1918platform_url = CONFIG_TDF .OPENTDF_PLATFORM_URL
@@ -28,8 +27,6 @@ class TestTDFReaderIntegration:
2827 def test_read_otdfctl_created_tdf_structure (self ):
2928 """Test that TDFReader can parse the structure of files created by otdfctl."""
3029
31- check_for_otdfctl ()
32-
3330 # Create temporary directory for work
3431 with tempfile .TemporaryDirectory () as temp_dir :
3532 temp_path = Path (temp_dir )
@@ -125,8 +122,6 @@ def test_read_otdfctl_created_tdf_structure(self):
125122 def test_read_otdfctl_tdf_with_attributes (self ):
126123 """Test reading TDF files created by otdfctl with data attributes."""
127124
128- check_for_otdfctl ()
129-
130125 # Create temporary directory for work
131126 with tempfile .TemporaryDirectory () as temp_dir :
132127 temp_path = Path (temp_dir )
@@ -215,8 +210,6 @@ def test_read_otdfctl_tdf_with_attributes(self):
215210 def test_read_multiple_otdfctl_files (self ):
216211 """Test reading multiple TDF files of different types created by otdfctl."""
217212
218- check_for_otdfctl ()
219-
220213 # Create temporary directory for work
221214 with tempfile .TemporaryDirectory () as temp_dir :
222215 temp_path = Path (temp_dir )
You can’t perform that action at this time.
0 commit comments