Skip to content

Commit

Permalink
Remove tmp dirs in TestClusteredQuantumGraph.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleGower committed Aug 6, 2024
1 parent 043cd01 commit a4b6bfa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
1 change: 1 addition & 0 deletions doc/changes/DM-45635.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed to remove tmp directories created in TestClusteredQuantumGraph.
16 changes: 2 additions & 14 deletions tests/test_clustered_quantum_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
# pylint: disable=invalid-name

import os
import shutil
import tempfile
import unittest
from collections import Counter
Expand Down Expand Up @@ -108,9 +109,7 @@ def setUp(self):
self.qgraph, self.cqg1 = make_test_clustered_quantum_graph(self.tmpdir)

def tearDown(self):
pass
# if self.tmpdir is not None and os.path.exists(self.tmpdir):
# shutil.rmtree(self.tmppath, ignore_errors=True)
shutil.rmtree(self.tmpdir, ignore_errors=True)

def testName(self):
self.assertEqual(self.cqg1.name, "cqg1")
Expand All @@ -119,9 +118,6 @@ def testQgraph(self):
"""Test qgraph method."""
self.assertEqual(self.cqg1.qgraph, self.qgraph)

# def testAddClusterSingle(self):
# """Test add_cluster method for single new cluster."""

def testGetClusterExists(self):
"""Test get_cluster method where cluster exists."""
self.assertEqual("T1_1_2", self.cqg1.get_cluster("T1_1_2").name)
Expand All @@ -131,12 +127,6 @@ def testGetClusterMissing(self):
with self.assertRaises(KeyError):
_ = self.cqg1.get_cluster("Not_There")

# def testGetQuantumNodeExists(self):
# """Test get_quantum_node method where node exists."""
#
# def testGetQuantumNodeMissing(self):
# """Test get_quantum_node method where node doesn't exist."""

def testClusters(self):
"""Test clusters method returns in correct order."""

Expand All @@ -158,8 +148,6 @@ def testPredecessorsNone(self):
# check iterable and empty
self.assertEqual(len(list(self.cqg1.predecessors("T1_1_2"))), 0)

# def testAddDependency(self):

def testSaveAndLoad(self):
path = Path(f"{self.tmpdir}/save_1.pickle")
self.cqg1.save(path)
Expand Down

0 comments on commit a4b6bfa

Please sign in to comment.