-
-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate aliases pointing to the legacy implementation.
- Loading branch information
Showing
10 changed files
with
101 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
from __future__ import annotations | ||
|
||
# See #940 for why lazy_import isn't used here for backwards compatibility. | ||
# See #1400 for why listing compatibility imports in __all__ helps PyCharm. | ||
import warnings | ||
|
||
from .legacy.auth import * | ||
from .legacy.auth import __all__ # noqa: F401 | ||
|
||
|
||
warnings.warn( # deprecated in 14.0 | ||
"websockets.auth is deprecated", | ||
DeprecationWarning, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,46 @@ | ||
import unittest | ||
|
||
import websockets | ||
import websockets.auth | ||
import websockets.asyncio.client | ||
import websockets.asyncio.server | ||
import websockets.client | ||
import websockets.datastructures | ||
import websockets.exceptions | ||
import websockets.legacy.protocol | ||
import websockets.server | ||
import websockets.typing | ||
import websockets.uri | ||
|
||
|
||
combined_exports = ( | ||
websockets.auth.__all__ | ||
[] | ||
+ websockets.asyncio.client.__all__ | ||
+ websockets.asyncio.server.__all__ | ||
+ websockets.client.__all__ | ||
+ websockets.datastructures.__all__ | ||
+ websockets.exceptions.__all__ | ||
+ websockets.legacy.protocol.__all__ | ||
+ websockets.server.__all__ | ||
+ websockets.typing.__all__ | ||
) | ||
|
||
# These API are intentionally not re-exported by the top-level module. | ||
missing_reexports = [ | ||
# websockets.asyncio.client | ||
"ClientConnection", | ||
# websockets.asyncio.server | ||
"ServerConnection", | ||
"Server", | ||
] | ||
|
||
|
||
class ExportsTests(unittest.TestCase): | ||
def test_top_level_module_reexports_all_submodule_exports(self): | ||
self.assertEqual(set(combined_exports), set(websockets.__all__)) | ||
def test_top_level_module_reexports_submodule_exports(self): | ||
self.assertEqual( | ||
set(combined_exports), | ||
set(websockets.__all__ + missing_reexports), | ||
) | ||
|
||
def test_submodule_exports_are_globally_unique(self): | ||
self.assertEqual(len(set(combined_exports)), len(combined_exports)) | ||
self.assertEqual( | ||
len(set(combined_exports)), | ||
len(combined_exports), | ||
) |