Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Clean-up some broken code in the test framework #8514

Merged
merged 3 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8514.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove unused code from the test framework.
2 changes: 0 additions & 2 deletions tests/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@ def setup_test_homeserver(cleanup_func, *args, **kwargs):
"""
server = _sth(cleanup_func, *args, **kwargs)

database = server.config.database.get_single_database()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell this isn't doing anything special (like causing the database to get cached or something).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. I came across it the other day too.


# Make the thread pool synchronous.
clock = server.get_clock()

Expand Down
16 changes: 1 addition & 15 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ class TestHomeServer(HomeServer):
def setup_test_homeserver(
cleanup_func,
name="test",
datastore=None,
config=None,
reactor=None,
homeserverToUse=TestHomeServer,
Expand Down Expand Up @@ -249,7 +248,7 @@ def setup_test_homeserver(

# Create the database before we actually try and connect to it, based off
# the template database we generate in setupdb()
if datastore is None and isinstance(db_engine, PostgresEngine):
if isinstance(db_engine, PostgresEngine):
db_conn = db_engine.module.connect(
database=POSTGRES_BASE_DB,
user=POSTGRES_USER,
Expand All @@ -265,7 +264,6 @@ def setup_test_homeserver(
cur.close()
db_conn.close()

if datastore is None:
hs = homeserverToUse(
name,
config=config,
Expand Down Expand Up @@ -327,18 +325,6 @@ def cleanup():
# Register the cleanup hook
cleanup_func(cleanup)

else:
hs = homeserverToUse(
name,
datastore=datastore,
config=config,
version_string="Synapse/tests",
tls_server_context_factory=Mock(),
tls_client_options_factory=Mock(),
reactor=reactor,
**kargs
)

# bcrypt is far too slow to be doing in unit tests
# Need to let the HS build an auth handler and then mess with it
# because AuthHandler's constructor requires the HS, so we can't make one
Expand Down