mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-21 22:07:51 +00:00
Python 3 port is essentially done-get rid of relevant tests and tracking code.
This commit is contained in:
parent
6a91a10c4c
commit
d060af641a
0
newsfragments/3751.minor
Normal file
0
newsfragments/3751.minor
Normal file
@ -72,10 +72,6 @@ python.pkgs.buildPythonPackage rec {
|
||||
rm src/allmydata/test/test_connections.py
|
||||
rm src/allmydata/test/cli/test_create.py
|
||||
|
||||
# Since we're deleting files, this complains they're missing. For now Nix
|
||||
# is Python 2-only, anyway, so these tests don't add anything yet.
|
||||
rm src/allmydata/test/test_python3.py
|
||||
|
||||
# Generate _version.py ourselves since we can't rely on the Python code
|
||||
# extracting the information from the .git directory we excluded.
|
||||
cat > src/allmydata/_version.py <<EOF
|
||||
|
@ -1,122 +0,0 @@
|
||||
"""
|
||||
Tests related to the Python 3 porting effort itself.
|
||||
|
||||
This module has been ported to Python 3.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
from future.utils import PY2, native_str
|
||||
if PY2:
|
||||
from builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
|
||||
|
||||
from twisted.python.modules import (
|
||||
getModule,
|
||||
)
|
||||
from twisted.trial.unittest import (
|
||||
SynchronousTestCase,
|
||||
)
|
||||
|
||||
from allmydata.util._python3 import PORTED_MODULES, PORTED_TEST_MODULES
|
||||
|
||||
|
||||
class Python3PortingEffortTests(SynchronousTestCase):
|
||||
|
||||
def test_finished_porting(self):
|
||||
"""
|
||||
Tahoe-LAFS has been ported to Python 3.
|
||||
|
||||
Once
|
||||
https://tahoe-lafs.org/trac/tahoe-lafs/milestone/Support%20Python%203
|
||||
is completed this test should pass (and can be deleted!).
|
||||
"""
|
||||
tahoe_lafs_module_names = set(all_module_names("allmydata"))
|
||||
ported_names = set(ported_module_names())
|
||||
self.assertEqual(
|
||||
tahoe_lafs_module_names - ported_names,
|
||||
set(),
|
||||
"Some unported modules remain: {}".format(
|
||||
unported_report(
|
||||
tahoe_lafs_module_names,
|
||||
ported_names,
|
||||
),
|
||||
),
|
||||
)
|
||||
test_finished_porting.todo = native_str( # type: ignore
|
||||
"https://tahoe-lafs.org/trac/tahoe-lafs/milestone/Support%20Python%203 should be completed",
|
||||
)
|
||||
|
||||
def test_ported_modules_exist(self):
|
||||
"""
|
||||
All modules listed as ported exist and belong to Tahoe-LAFS.
|
||||
"""
|
||||
tahoe_lafs_module_names = set(all_module_names("allmydata"))
|
||||
ported_names = set(ported_module_names())
|
||||
unknown = ported_names - tahoe_lafs_module_names
|
||||
self.assertEqual(
|
||||
unknown,
|
||||
set(),
|
||||
"Some supposedly-ported modules weren't found: {}.".format(sorted(unknown)),
|
||||
)
|
||||
|
||||
def test_ported_modules_distinct(self):
|
||||
"""
|
||||
The ported modules list doesn't contain duplicates.
|
||||
"""
|
||||
ported_names_list = ported_module_names()
|
||||
ported_names_list.sort()
|
||||
ported_names_set = set(ported_names_list)
|
||||
ported_names_unique_list = list(ported_names_set)
|
||||
ported_names_unique_list.sort()
|
||||
self.assertEqual(
|
||||
ported_names_list,
|
||||
ported_names_unique_list,
|
||||
)
|
||||
|
||||
|
||||
def all_module_names(toplevel):
|
||||
"""
|
||||
:param unicode toplevel: The name of a top-level Python package.
|
||||
|
||||
:return iterator[unicode]: An iterator of ``unicode`` giving the names of
|
||||
all modules within the given top-level Python package.
|
||||
"""
|
||||
allmydata = getModule(toplevel)
|
||||
for module in allmydata.walkModules():
|
||||
name = module.name
|
||||
if PY2:
|
||||
name = name.decode("utf-8")
|
||||
yield name
|
||||
|
||||
|
||||
def ported_module_names():
|
||||
"""
|
||||
:return list[unicode]: A ``list`` of ``unicode`` giving the names of
|
||||
Tahoe-LAFS modules which have been ported to Python 3.
|
||||
"""
|
||||
return PORTED_MODULES + PORTED_TEST_MODULES
|
||||
|
||||
|
||||
def unported_report(tahoe_lafs_module_names, ported_names):
|
||||
return """
|
||||
Ported files: {} / {}
|
||||
Ported lines: {} / {}
|
||||
""".format(
|
||||
len(ported_names),
|
||||
len(tahoe_lafs_module_names),
|
||||
sum(map(count_lines, ported_names)),
|
||||
sum(map(count_lines, tahoe_lafs_module_names)),
|
||||
)
|
||||
|
||||
def count_lines(module_name):
|
||||
module = getModule(module_name)
|
||||
try:
|
||||
source = module.filePath.getContent()
|
||||
except Exception as e:
|
||||
print((module_name, e))
|
||||
return 0
|
||||
lines = source.splitlines()
|
||||
nonblank = [_f for _f in lines if _f]
|
||||
return len(nonblank)
|
@ -1,311 +0,0 @@
|
||||
"""
|
||||
Track the port to Python 3.
|
||||
|
||||
At this point all unit tests have been ported to Python 3, so you can just run
|
||||
them normally.
|
||||
|
||||
This module has been ported to Python 3.
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
from future.utils import PY2
|
||||
if PY2:
|
||||
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
|
||||
|
||||
|
||||
PORTED_INTEGRATION_TESTS = [
|
||||
"integration.test_aaa_aardvark",
|
||||
"integration.test_servers_of_happiness",
|
||||
"integration.test_sftp",
|
||||
"integration.test_streaming_logs",
|
||||
"integration.test_tor",
|
||||
"integration.test_web",
|
||||
]
|
||||
|
||||
PORTED_INTEGRATION_MODULES = [
|
||||
"integration",
|
||||
"integration.conftest",
|
||||
"integration.util",
|
||||
]
|
||||
|
||||
# Keep these sorted alphabetically, to reduce merge conflicts:
|
||||
PORTED_MODULES = [
|
||||
"allmydata",
|
||||
"allmydata.__main__",
|
||||
"allmydata._auto_deps",
|
||||
"allmydata._monkeypatch",
|
||||
"allmydata.blacklist",
|
||||
"allmydata.check_results",
|
||||
"allmydata.client",
|
||||
"allmydata.codec",
|
||||
"allmydata.control",
|
||||
"allmydata.crypto",
|
||||
"allmydata.crypto.aes",
|
||||
"allmydata.crypto.ed25519",
|
||||
"allmydata.crypto.error",
|
||||
"allmydata.crypto.rsa",
|
||||
"allmydata.crypto.util",
|
||||
"allmydata.deep_stats",
|
||||
"allmydata.dirnode",
|
||||
"allmydata.frontends",
|
||||
"allmydata.frontends.auth",
|
||||
"allmydata.frontends.sftpd",
|
||||
"allmydata.hashtree",
|
||||
"allmydata.history",
|
||||
"allmydata.immutable",
|
||||
"allmydata.immutable.checker",
|
||||
"allmydata.immutable.downloader",
|
||||
"allmydata.immutable.downloader.common",
|
||||
"allmydata.immutable.downloader.fetcher",
|
||||
"allmydata.immutable.downloader.finder",
|
||||
"allmydata.immutable.downloader.node",
|
||||
"allmydata.immutable.downloader.segmentation",
|
||||
"allmydata.immutable.downloader.share",
|
||||
"allmydata.immutable.downloader.status",
|
||||
"allmydata.immutable.encode",
|
||||
"allmydata.immutable.filenode",
|
||||
"allmydata.immutable.happiness_upload",
|
||||
"allmydata.immutable.layout",
|
||||
"allmydata.immutable.literal",
|
||||
"allmydata.immutable.offloaded",
|
||||
"allmydata.immutable.repairer",
|
||||
"allmydata.immutable.upload",
|
||||
"allmydata.interfaces",
|
||||
"allmydata.introducer",
|
||||
"allmydata.introducer.client",
|
||||
"allmydata.introducer.common",
|
||||
"allmydata.introducer.interfaces",
|
||||
"allmydata.introducer.server",
|
||||
"allmydata.monitor",
|
||||
"allmydata.mutable",
|
||||
"allmydata.mutable.checker",
|
||||
"allmydata.mutable.common",
|
||||
"allmydata.mutable.filenode",
|
||||
"allmydata.mutable.layout",
|
||||
"allmydata.mutable.publish",
|
||||
"allmydata.mutable.repairer",
|
||||
"allmydata.mutable.retrieve",
|
||||
"allmydata.mutable.servermap",
|
||||
"allmydata.node",
|
||||
"allmydata.nodemaker",
|
||||
"allmydata.scripts",
|
||||
"allmydata.scripts.admin",
|
||||
"allmydata.scripts.backupdb",
|
||||
"allmydata.scripts.cli",
|
||||
"allmydata.scripts.common_http",
|
||||
"allmydata.scripts.common",
|
||||
"allmydata.scripts.create_node",
|
||||
"allmydata.scripts.debug",
|
||||
"allmydata.scripts.default_nodedir",
|
||||
"allmydata.scripts.runner",
|
||||
"allmydata.scripts.slow_operation",
|
||||
"allmydata.scripts.tahoe_add_alias",
|
||||
"allmydata.scripts.tahoe_backup",
|
||||
"allmydata.scripts.tahoe_check",
|
||||
"allmydata.scripts.tahoe_cp",
|
||||
"allmydata.scripts.tahoe_get",
|
||||
"allmydata.scripts.tahoe_invite",
|
||||
"allmydata.scripts.tahoe_ls",
|
||||
"allmydata.scripts.tahoe_manifest",
|
||||
"allmydata.scripts.tahoe_mkdir",
|
||||
"allmydata.scripts.tahoe_mv",
|
||||
"allmydata.scripts.tahoe_put",
|
||||
"allmydata.scripts.tahoe_run",
|
||||
"allmydata.scripts.tahoe_status",
|
||||
"allmydata.scripts.tahoe_unlink",
|
||||
"allmydata.scripts.tahoe_webopen",
|
||||
"allmydata.scripts.types_",
|
||||
"allmydata.stats",
|
||||
"allmydata.storage_client",
|
||||
"allmydata.storage",
|
||||
"allmydata.storage.common",
|
||||
"allmydata.storage.crawler",
|
||||
"allmydata.storage.expirer",
|
||||
"allmydata.storage.immutable",
|
||||
"allmydata.storage.lease",
|
||||
"allmydata.storage.mutable",
|
||||
"allmydata.storage.server",
|
||||
"allmydata.storage.shares",
|
||||
"allmydata.test",
|
||||
"allmydata.test.cli",
|
||||
"allmydata.test.cli.common",
|
||||
"allmydata.test.cli_node_api",
|
||||
"allmydata.test.common",
|
||||
"allmydata.test.common_util",
|
||||
"allmydata.test.common_web",
|
||||
"allmydata.test.eliotutil",
|
||||
"allmydata.test.no_network",
|
||||
"allmydata.test.matchers",
|
||||
"allmydata.test.mutable",
|
||||
"allmydata.test.mutable.util",
|
||||
"allmydata.test.storage_plugin",
|
||||
"allmydata.test.strategies",
|
||||
"allmydata.test.web",
|
||||
"allmydata.test.web.common",
|
||||
"allmydata.test.web.matchers",
|
||||
"allmydata.testing",
|
||||
"allmydata.testing.web",
|
||||
"allmydata.unknown",
|
||||
"allmydata.uri",
|
||||
"allmydata.util",
|
||||
"allmydata.util._python3",
|
||||
"allmydata.util.abbreviate",
|
||||
"allmydata.util.assertutil",
|
||||
"allmydata.util.base32",
|
||||
"allmydata.util.base62",
|
||||
"allmydata.util.configutil",
|
||||
"allmydata.util.connection_status",
|
||||
"allmydata.util.consumer",
|
||||
"allmydata.util.dbutil",
|
||||
"allmydata.util.deferredutil",
|
||||
"allmydata.util.dictutil",
|
||||
"allmydata.util.eliotutil",
|
||||
"allmydata.util.encodingutil",
|
||||
"allmydata.util.fileutil",
|
||||
"allmydata.util.gcutil",
|
||||
"allmydata.util.happinessutil",
|
||||
"allmydata.util.hashutil",
|
||||
"allmydata.util.humanreadable",
|
||||
"allmydata.util.i2p_provider",
|
||||
"allmydata.util.idlib",
|
||||
"allmydata.util.iputil",
|
||||
"allmydata.util.jsonbytes",
|
||||
"allmydata.util.log",
|
||||
"allmydata.util.mathutil",
|
||||
"allmydata.util.namespace",
|
||||
"allmydata.util.netstring",
|
||||
"allmydata.util.observer",
|
||||
"allmydata.util.pipeline",
|
||||
"allmydata.util.pollmixin",
|
||||
"allmydata.util.rrefutil",
|
||||
"allmydata.util.spans",
|
||||
"allmydata.util.statistics",
|
||||
"allmydata.util.time_format",
|
||||
"allmydata.util.tor_provider",
|
||||
"allmydata.util.yamlutil",
|
||||
"allmydata.web",
|
||||
"allmydata.web.check_results",
|
||||
"allmydata.web.common",
|
||||
"allmydata.web.directory",
|
||||
"allmydata.web.filenode",
|
||||
"allmydata.web.info",
|
||||
"allmydata.web.introweb",
|
||||
"allmydata.web.logs",
|
||||
"allmydata.web.operations",
|
||||
"allmydata.web.private",
|
||||
"allmydata.web.root",
|
||||
"allmydata.web.status",
|
||||
"allmydata.web.storage",
|
||||
"allmydata.web.storage_plugins",
|
||||
"allmydata.web.unlinked",
|
||||
"allmydata.webish",
|
||||
"allmydata.windows",
|
||||
]
|
||||
|
||||
PORTED_TEST_MODULES = [
|
||||
"allmydata.test.cli.test_alias",
|
||||
"allmydata.test.cli.test_backup",
|
||||
"allmydata.test.cli.test_backupdb",
|
||||
"allmydata.test.cli.test_check",
|
||||
"allmydata.test.cli.test_cli",
|
||||
"allmydata.test.cli.test_cp",
|
||||
"allmydata.test.cli.test_create",
|
||||
"allmydata.test.cli.test_create_alias",
|
||||
"allmydata.test.cli.test_invite",
|
||||
"allmydata.test.cli.test_list",
|
||||
"allmydata.test.cli.test_mv",
|
||||
"allmydata.test.cli.test_put",
|
||||
"allmydata.test.cli.test_run",
|
||||
"allmydata.test.cli.test_status",
|
||||
|
||||
"allmydata.test.mutable.test_checker",
|
||||
"allmydata.test.mutable.test_datahandle",
|
||||
"allmydata.test.mutable.test_different_encoding",
|
||||
"allmydata.test.mutable.test_exceptions",
|
||||
"allmydata.test.mutable.test_filehandle",
|
||||
"allmydata.test.mutable.test_filenode",
|
||||
"allmydata.test.mutable.test_interoperability",
|
||||
"allmydata.test.mutable.test_multiple_encodings",
|
||||
"allmydata.test.mutable.test_multiple_versions",
|
||||
"allmydata.test.mutable.test_problems",
|
||||
"allmydata.test.mutable.test_repair",
|
||||
"allmydata.test.mutable.test_roundtrip",
|
||||
"allmydata.test.mutable.test_servermap",
|
||||
"allmydata.test.mutable.test_update",
|
||||
"allmydata.test.mutable.test_version",
|
||||
"allmydata.test.test_abbreviate",
|
||||
"allmydata.test.test_auth",
|
||||
"allmydata.test.test_base32",
|
||||
"allmydata.test.test_base62",
|
||||
"allmydata.test.test_checker",
|
||||
"allmydata.test.test_client",
|
||||
"allmydata.test.test_codec",
|
||||
"allmydata.test.test_common_util",
|
||||
"allmydata.test.test_configutil",
|
||||
"allmydata.test.test_connections",
|
||||
"allmydata.test.test_connection_status",
|
||||
"allmydata.test.test_consumer",
|
||||
"allmydata.test.test_crawler",
|
||||
"allmydata.test.test_crypto",
|
||||
"allmydata.test.test_deepcheck",
|
||||
"allmydata.test.test_deferredutil",
|
||||
"allmydata.test.test_dictutil",
|
||||
"allmydata.test.test_dirnode",
|
||||
"allmydata.test.test_download",
|
||||
"allmydata.test.test_eliotutil",
|
||||
"allmydata.test.test_encode",
|
||||
"allmydata.test.test_encodingutil",
|
||||
"allmydata.test.test_filenode",
|
||||
"allmydata.test.test_happiness",
|
||||
"allmydata.test.test_hashtree",
|
||||
"allmydata.test.test_hashutil",
|
||||
"allmydata.test.test_helper",
|
||||
"allmydata.test.test_humanreadable",
|
||||
"allmydata.test.test_hung_server",
|
||||
"allmydata.test.test_i2p_provider",
|
||||
"allmydata.test.test_immutable",
|
||||
"allmydata.test.test_introducer",
|
||||
"allmydata.test.test_iputil",
|
||||
"allmydata.test.test_json_metadata",
|
||||
"allmydata.test.test_log",
|
||||
"allmydata.test.test_monitor",
|
||||
"allmydata.test.test_multi_introducers",
|
||||
"allmydata.test.test_netstring",
|
||||
"allmydata.test.test_no_network",
|
||||
"allmydata.test.test_node",
|
||||
"allmydata.test.test_observer",
|
||||
"allmydata.test.test_pipeline",
|
||||
"allmydata.test.test_python2_regressions",
|
||||
"allmydata.test.test_python3",
|
||||
"allmydata.test.test_repairer",
|
||||
"allmydata.test.test_runner",
|
||||
"allmydata.test.test_sftp",
|
||||
"allmydata.test.test_spans",
|
||||
"allmydata.test.test_statistics",
|
||||
"allmydata.test.test_stats",
|
||||
"allmydata.test.test_storage",
|
||||
"allmydata.test.test_storage_client",
|
||||
"allmydata.test.test_storage_web",
|
||||
"allmydata.test.test_system",
|
||||
"allmydata.test.test_testing",
|
||||
"allmydata.test.test_time_format",
|
||||
"allmydata.test.test_tor_provider",
|
||||
"allmydata.test.test_upload",
|
||||
"allmydata.test.test_uri",
|
||||
"allmydata.test.test_util",
|
||||
"allmydata.test.web.test_common",
|
||||
"allmydata.test.web.test_grid",
|
||||
"allmydata.test.web.test_introducer",
|
||||
"allmydata.test.web.test_logs",
|
||||
"allmydata.test.web.test_private",
|
||||
"allmydata.test.web.test_root",
|
||||
"allmydata.test.web.test_status",
|
||||
"allmydata.test.web.test_util",
|
||||
"allmydata.test.web.test_web",
|
||||
"allmydata.test.web.test_webish",
|
||||
"allmydata.test.test_windows",
|
||||
]
|
Loading…
Reference in New Issue
Block a user