Skip to content

Commit b28d5a5

Browse files
authored
Minor improvements: prevent future test failures, remove fixtures, and more (#1446)
* Fix typo (makes nox -elint happy) * Prevent tests from failing with Networkx 3.6 * Pin ruff * Use try/except to support Python 3.9
1 parent 03799b3 commit b28d5a5

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,13 @@ testinfra = [
7373
]
7474
test = [
7575
"setuptools-rust",
76-
"fixtures",
7776
"testtools>=2.5.0",
78-
"networkx>=2.5",
77+
"networkx>=3.2",
7978
"stestr>=4.1",
8079
]
8180
lint = [
8281
"black~=24.8",
83-
"ruff~=0.6",
82+
"ruff==0.11.9",
8483
"setuptools-rust",
8584
"typos~=1.28",
8685
]
@@ -108,7 +107,7 @@ releaseinfra = [
108107

109108
[tool.black]
110109
line-length = 100
111-
target-version = ['py39', 'py310', 'py311', 'py312']
110+
target-version = ['py39', 'py310', 'py311', 'py312', 'py313']
112111

113112
[tool.ruff]
114113
line-length = 105 # more lenient than black due to long function signatures

rustworkx-core/src/generators/random_graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use super::InvalidInputError;
4141
///
4242
/// Raises an error if
4343
///
44-
/// This algorithm is based on the implementation of networkx functon
44+
/// This algorithm is based on the implementation of networkx function
4545
/// <https://github.com/networkx/networkx/blob/networkx-2.4/networkx/generators/random_graphs.py>
4646
///
4747
/// A. Steger and N. Wormald,

tests/digraph/test_node_link_json.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ def test_round_trip_file(self):
174174

175175
def test_round_trip_networkx(self):
176176
graph = nx.generators.path_graph(5, create_using=nx.DiGraph)
177-
node_link_str = json.dumps(nx.node_link_data(graph))
177+
try:
178+
node_link_str = json.dumps(nx.node_link_data(graph, edges="links"))
179+
except TypeError:
180+
# TODO: Remove this once we no longer need to support Python 3.9
181+
node_link_str = json.dumps(nx.node_link_data(graph))
178182
new = rustworkx.parse_node_link_json(node_link_str)
179183
self.assertIsInstance(new, rustworkx.PyDiGraph)
180184
self.assertEqual(new.num_nodes(), graph.number_of_nodes())

tests/graph/test_node_link_json.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ def test_round_trip_with_file(self):
174174

175175
def test_round_trip_networkx(self):
176176
graph = nx.generators.path_graph(5)
177-
node_link_str = json.dumps(nx.node_link_data(graph))
177+
try:
178+
node_link_str = json.dumps(nx.node_link_data(graph, edges="links"))
179+
except TypeError:
180+
# TODO: Remove this once we no longer need to support Python 3.9
181+
node_link_str = json.dumps(nx.node_link_data(graph))
178182
new = rustworkx.parse_node_link_json(node_link_str)
179183
self.assertIsInstance(new, rustworkx.PyGraph)
180184
self.assertEqual(new.num_nodes(), graph.number_of_nodes())

0 commit comments

Comments
 (0)