Skip to content

Commit abca897

Browse files
authored
Fix from neo4j import * statement (#1009)
The `neo4j.__all__` list got outdated breaking the star import for the top-level driver module.
1 parent 7d2aa10 commit abca897

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/neo4j/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@
136136
"NotificationMinimumSeverity",
137137
"Neo4jDriver",
138138
"NotificationCategory",
139-
"NotificationFilter",
140139
"NotificationSeverity",
141140
"PoolConfig",
142141
"PreviewWarning",
@@ -145,7 +144,6 @@
145144
"Record",
146145
"Result",
147146
"ResultSummary",
148-
"RenewableAuth",
149147
"RoutingControl",
150148
"ServerInfo",
151149
"Session",

tests/unit/common/test_import_neo4j.py

+18
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# limitations under the License.
1515

1616

17+
import importlib
18+
1719
import pytest
1820

1921

@@ -166,3 +168,19 @@ def test_import_time():
166168

167169
def test_import_exceptions():
168170
from neo4j import exceptions
171+
172+
173+
def test_import_star():
174+
with pytest.warns() as warnings:
175+
importlib.__import__("neo4j", fromlist=("*",))
176+
assert len(warnings) == 5
177+
assert all(issubclass(w.category, DeprecationWarning) for w in warnings)
178+
messages = {str(w.message) for w in warnings}
179+
for item in (
180+
"log", "Config", "PoolConfig", "SessionConfig", "WorkspaceConfig"
181+
):
182+
message = (
183+
f"Importing {item} from neo4j is deprecated without replacement. "
184+
f"It's internal and will be removed in a future version."
185+
)
186+
assert message in messages

0 commit comments

Comments
 (0)