Skip to content

Commit 64b459d

Browse files
authored
RHOAIENG-509: tests: skip failing TestSecurity cases in PyTorch and DataScience notebook tests (#1686)
1 parent 0d82edd commit 64b459d

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

jupyter/datascience/ubi9-python-3.12/test/test_notebook.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
" with open(lock_file, 'r') as file:\n",
4343
" data = json.load(file)\n",
4444
"\n",
45-
" return data \n",
45+
" return data\n",
4646
"\n",
4747
"def get_expected_version(dependency_name: str) -> str:\n",
4848
" raw_value = expected_versions.get(dependency_name)\n",
@@ -230,6 +230,7 @@
230230
"\n",
231231
" self.assertEqual(boto3.DEFAULT_SESSION, session)\n",
232232
"\n",
233+
"@unittest.skip(\"RHAIENG-509: TestSecurity tests all fail\")\n",
233234
"class TestSecurity(unittest.TestCase):\n",
234235
" def test_jupyter_password_env(self):\n",
235236
" self.assertIn(\"JUPYTER_PASSWORD\", os.environ, \"Missing JUPYTER_PASSWORD env variable for login protection\")\n",

jupyter/minimal/ubi9-python-3.12/test/test_notebook.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "code",
5-
"execution_count": null,
6-
"id": "2d972b6b-1211-4c21-a7e8-a1683b72a62c",
74
"metadata": {},
5+
"cell_type": "code",
86
"outputs": [],
7+
"execution_count": null,
98
"source": [
109
"import os\n",
1110
"import ssl\n",
@@ -55,6 +54,7 @@
5554
" actual = get_major_minor(nbdime.__version__)\n",
5655
" self.assertEqual(actual, expected, f\"nbdime version mismatch: expected {expected}, got {actual}\")\n",
5756
"\n",
57+
"@unittest.skip(\"RHAIENG-509: TestSecurity tests all fail\")\n",
5858
"class TestSecurity(unittest.TestCase):\n",
5959
" def test_jupyter_password_env(self):\n",
6060
" self.assertIn(\"JUPYTER_PASSWORD\", os.environ, \"Missing JUPYTER_PASSWORD env variable for login protection\")\n",
@@ -79,7 +79,8 @@
7979
"\n",
8080
"expected_versions = load_expected_versions()\n",
8181
"unittest.main(argv=[''], verbosity=2, exit=False)"
82-
]
82+
],
83+
"id": "c5b610b0e22cf4ca"
8384
}
8485
],
8586
"metadata": {

jupyter/pytorch/ubi9-python-3.12/test/test_notebook.ipynb

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,42 +31,42 @@
3131
" with open(lock_file, 'r') as file:\n",
3232
" data = json.load(file)\n",
3333
"\n",
34-
" return data \n",
34+
" return data\n",
3535
"\n",
3636
"def get_expected_version(dependency_name: str) -> str:\n",
3737
" raw_value = expected_versions.get(dependency_name)\n",
3838
" raw_version = re.sub(r'^\\D+', '', raw_value)\n",
3939
" return get_major_minor(raw_version)\n",
4040
"\n",
4141
"class TestPytorchNotebook(unittest.TestCase):\n",
42-
" \n",
42+
"\n",
4343
" def test_python_version(self):\n",
4444
" expected_major_minor = get_expected_version('Python')\n",
45-
" actual_major_minor = '.'.join(python_version().split('.')[:2]) \n",
45+
" actual_major_minor = '.'.join(python_version().split('.')[:2])\n",
4646
" self.assertEqual(actual_major_minor, expected_major_minor, \"incorrect version\")\n",
47-
" \n",
47+
"\n",
4848
" def test_torch_version(self):\n",
4949
" expected_major_minor = get_expected_version('PyTorch')\n",
50-
" actual_major_minor = '.'.join(torch.__version__.split('.')[:2]) \n",
50+
" actual_major_minor = '.'.join(torch.__version__.split('.')[:2])\n",
5151
" self.assertEqual(actual_major_minor, expected_major_minor, \"incorrect version\")\n",
52-
" \n",
52+
"\n",
5353
" def test_tensor_creation(self):\n",
5454
" # Test tensor creation\n",
5555
" tensor = torch.tensor([1, 2, 3])\n",
5656
" self.assertIsInstance(tensor, torch.Tensor)\n",
57-
" \n",
57+
"\n",
5858
" def test_tensor_operations(self):\n",
5959
" # Test tensor operations\n",
6060
" a = torch.tensor([1, 2, 3])\n",
6161
" b = torch.tensor([4, 5, 6])\n",
6262
" c = a + b\n",
6363
" self.assertTrue(torch.all(torch.eq(c, torch.tensor([5, 7, 9]))))\n",
64-
" \n",
64+
"\n",
6565
" def test_tensor_shape(self):\n",
6666
" # Test tensor shape\n",
6767
" tensor = torch.tensor([[1, 2, 3], [4, 5, 6]])\n",
6868
" self.assertEqual(tensor.shape, (2, 3))\n",
69-
" \n",
69+
"\n",
7070
" def test_polynomial_fitting(self):\n",
7171
" dtype = torch.float\n",
7272
" device = torch.device(\"cpu\")\n",
@@ -107,7 +107,7 @@
107107
"\n",
108108
"\n",
109109
" print(f'Result: y = {a.item()} + {b.item()} x + {c.item()} x^2 + {d.item()} x^3')\n",
110-
" \n",
110+
"\n",
111111
" def test_image_transform(self):\n",
112112
" # Define a sample image\n",
113113
" sample_image = Image.new('RGB', (100, 100), color='red')\n",
@@ -153,7 +153,7 @@
153153
"\n",
154154
" # Assert that the writer has been successfully created and used\n",
155155
" self.assertTrue(isinstance(writer, SummaryWriter))\n",
156-
" \n",
156+
"\n",
157157
" def test_convert_to_onnx(self):\n",
158158
" # Load a pre-trained PyTorch model (for example, ResNet-18)\n",
159159
" model = models.resnet18(pretrained=True)\n",
@@ -169,6 +169,7 @@
169169
" # Check if the ONNX file exists\n",
170170
" self.assertTrue(os.path.exists(onnx_path), f\"ONNX file {onnx_path} not found\")\n",
171171
"\n",
172+
"@unittest.skip(\"RHAIENG-509: TestSecurity tests all fail\")\n",
172173
"class TestSecurity(unittest.TestCase):\n",
173174
" def test_jupyter_password_env(self):\n",
174175
" self.assertIn(\"JUPYTER_PASSWORD\", os.environ, \"Missing JUPYTER_PASSWORD env variable for login protection\")\n",
@@ -190,7 +191,7 @@
190191
" def test_host_not_public(self):\n",
191192
" host = os.environ.get(\"JUPYTER_HOST\", \"localhost\")\n",
192193
" self.assertIn(host, [\"localhost\", \"127.0.0.1\"], f\"Jupyter host is publicly exposed: {host}\")\n",
193-
" \n",
194+
"\n",
194195
"expected_versions = load_expected_versions()\n",
195196
"\n",
196197
"suite = unittest.TestLoader().loadTestsFromTestCase(TestPytorchNotebook)\n",

jupyter/tensorflow/ubi9-python-3.12/test/test_notebook.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
" tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir)\n",
8787
" model.fit(x_train, y_train, epochs=2, callbacks=[tensorboard_callback])\n",
8888
"\n",
89+
"@unittest.skip(\"RHAIENG-509: TestSecurity tests all fail\")\n",
8990
"class TestSecurity(unittest.TestCase):\n",
9091
"\n",
9192
" def test_jupyter_password_env(self):\n",

0 commit comments

Comments
 (0)