File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages
2- # This file should only contain the following line. Otherwise other sub-packages databricks.* namespace
3- # may not be importable.
1+ # See: https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages
2+ #
3+ # This file must only contain the following line, or other packages in the databricks.* namespace
4+ # may not be importable. The contents of this file must be byte-for-byte equivalent across all packages.
5+ # If they are not, parallel package installation may lead to clobbered and invalid files.
6+ # Also see https://github.com/databricks/databricks-sdk-py/issues/343.
47__path__ = __import__ ("pkgutil" ).extend_path (__path__ , __name__ )
Original file line number Diff line number Diff line change 1+ import hashlib
2+ import unittest
3+
4+
5+ class InitFileTests (unittest .TestCase ):
6+ """
7+ Micro test to confirm the contents of `databricks/__init__.py` does not change.
8+
9+ Also see https://github.com/databricks/databricks-sdk-py/issues/343#issuecomment-1866029118.
10+ """
11+
12+ def test_init_file_contents (self ):
13+ with open ('src/databricks/__init__.py' ) as f :
14+ init_file_contents = f .read ()
15+
16+ # This hash is the expected hash of the contents of `src/databricks/__init__.py`.
17+ # It must not change, or else parallel package installation may lead to clobbered and invalid files.
18+ expected_sha1 = '2772edbf52e517542acf8c039479c4b57b6ca2cd'
19+ actual_sha1 = hashlib .sha1 (init_file_contents .encode ('utf-8' )).hexdigest ()
20+ self .assertEqual (expected_sha1 , actual_sha1 )
21+
22+
23+ if __name__ == '__main__' :
24+ unittest .main ()
You can’t perform that action at this time.
0 commit comments