Remove deprecated parameter

main
Bob Mottram 2024-05-16 16:57:44 +01:00
parent 1002e078e6
commit 16c22658d1
3 changed files with 52 additions and 59 deletions

View File

@ -3505,24 +3505,18 @@ def _command_options() -> None:
print('Generating some test data for user: ' + nickname)
if os.path.isdir(base_dir + '/tags'):
shutil.rmtree(base_dir + '/tags',
ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/tags', ignore_errors=False)
dir_str = data_dir(base_dir)
if os.path.isdir(dir_str):
shutil.rmtree(dir_str,
ignore_errors=False, onerror=None)
shutil.rmtree(dir_str, ignore_errors=False)
if os.path.isdir(base_dir + '/keys'):
shutil.rmtree(base_dir + '/keys',
ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/keys', ignore_errors=False)
if os.path.isdir(base_dir + '/media'):
shutil.rmtree(base_dir + '/media',
ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/media', ignore_errors=False)
if os.path.isdir(base_dir + '/sharefiles'):
shutil.rmtree(base_dir + '/sharefiles',
ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/sharefiles', ignore_errors=False)
if os.path.isdir(base_dir + '/wfendpoints'):
shutil.rmtree(base_dir + '/wfendpoints',
ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/wfendpoints', ignore_errors=False)
set_config_param(base_dir, 'registrationsRemaining',
str(max_registrations))

View File

@ -1424,11 +1424,10 @@ def remove_account(base_dir: str, nickname: str,
_remove_tags_for_nickname(base_dir, nickname, domain, port)
if os.path.isdir(base_dir + '/deactivated/' + handle):
shutil.rmtree(base_dir + '/deactivated/' + handle,
ignore_errors=False, onerror=None)
ignore_errors=False)
handle_dir = acct_handle_dir(base_dir, handle)
if os.path.isdir(handle_dir):
shutil.rmtree(handle_dir,
ignore_errors=False, onerror=None)
shutil.rmtree(handle_dir, ignore_errors=False)
if os.path.isfile(handle_dir + '.json'):
try:
os.remove(handle_dir + '.json')
@ -1455,7 +1454,7 @@ def remove_account(base_dir: str, nickname: str,
base_dir + '/keys/public/' + handle + '.pem')
if os.path.isdir(base_dir + '/sharefiles/' + nickname):
shutil.rmtree(base_dir + '/sharefiles/' + nickname,
ignore_errors=False, onerror=None)
ignore_errors=False)
if os.path.isfile(base_dir + '/wfdeactivated/' + handle + '.json'):
try:
os.remove(base_dir + '/wfdeactivated/' + handle + '.json')
@ -1464,7 +1463,7 @@ def remove_account(base_dir: str, nickname: str,
base_dir + '/wfdeactivated/' + handle + '.json')
if os.path.isdir(base_dir + '/sharefilesdeactivated/' + nickname):
shutil.rmtree(base_dir + '/sharefilesdeactivated/' + nickname,
ignore_errors=False, onerror=None)
ignore_errors=False)
refresh_newswire(base_dir)

View File

@ -306,7 +306,7 @@ def _test_http_signed_get(base_dir: str):
path = base_dir + '/.testHttpsigGET'
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
os.mkdir(path)
os.chdir(path)
@ -352,7 +352,7 @@ def _test_http_signed_get(base_dir: str):
boxpath, getreq_method, None,
message_body_json_str, debug, no_recency_check)
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
def _test_sign_and_verify() -> None:
@ -586,7 +586,7 @@ def _test_httpsig_base(with_digest: bool, base_dir: str):
path = base_dir + '/.testHttpsigBase'
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
os.mkdir(path)
os.chdir(path)
@ -700,7 +700,7 @@ def _test_httpsig_base(with_digest: bool, base_dir: str):
message_body_json_str, False) is False
os.chdir(base_dir)
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
def _test_httpsig(base_dir: str):
@ -747,7 +747,7 @@ def create_server_alice(path: str, domain: str, port: int,
send_threads: []):
print('Creating test server: Alice on port ' + str(port))
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
os.mkdir(path)
os.chdir(path)
shared_items_federated_domains = []
@ -933,7 +933,7 @@ def create_server_bob(path: str, domain: str, port: int,
send_threads: []):
print('Creating test server: Bob on port ' + str(port))
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
os.mkdir(path)
os.chdir(path)
shared_items_federated_domains = []
@ -1118,7 +1118,7 @@ def create_server_eve(path: str, domain: str, port: int, federation_list: [],
send_threads: []):
print('Creating test server: Eve on port ' + str(port))
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
os.mkdir(path)
os.chdir(path)
shared_items_federated_domains = []
@ -1233,7 +1233,7 @@ def create_server_group(path: str, domain: str, port: int,
send_threads: []):
print('Creating test server: Group on port ' + str(port))
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
os.mkdir(path)
os.chdir(path)
shared_items_federated_domains = []
@ -1340,7 +1340,7 @@ def test_post_message_between_servers(base_dir: str) -> None:
media_creator = 'Secret Squirrel'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False)
os.mkdir(base_dir + '/.tests')
# create the servers
@ -1672,8 +1672,8 @@ def test_post_message_between_servers(base_dir: str) -> None:
assert THR_BOB.is_alive() is False
os.chdir(base_dir)
shutil.rmtree(alice_dir, ignore_errors=False, onerror=None)
shutil.rmtree(bob_dir, ignore_errors=False, onerror=None)
shutil.rmtree(alice_dir, ignore_errors=False)
shutil.rmtree(bob_dir, ignore_errors=False)
def test_follow_between_servers(base_dir: str) -> None:
@ -1694,7 +1694,7 @@ def test_follow_between_servers(base_dir: str) -> None:
media_creator = 'Penfold'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False)
os.mkdir(base_dir + '/.tests')
# create the servers
@ -1878,7 +1878,7 @@ def test_follow_between_servers(base_dir: str) -> None:
if os.path.isfile(os.path.join(queue_path, name))]) == 0
os.chdir(base_dir)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False)
def test_shared_items_federation(base_dir: str) -> None:
@ -1899,7 +1899,7 @@ def test_shared_items_federation(base_dir: str) -> None:
media_creator = 'Dr Drokk'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False)
os.mkdir(base_dir + '/.tests')
# create the servers
@ -2053,7 +2053,7 @@ def test_shared_items_federation(base_dir: str) -> None:
print('\n\n*********************************************************')
print('Bob publishes some shared items')
if os.path.isdir(bob_dir + '/ontology'):
shutil.rmtree(bob_dir + '/ontology', ignore_errors=False, onerror=None)
shutil.rmtree(bob_dir + '/ontology', ignore_errors=False)
os.mkdir(bob_dir + '/ontology')
copyfile(base_dir + '/img/logo.png', bob_dir + '/logo.png')
copyfile(base_dir + '/ontology/foodTypes.json',
@ -2328,7 +2328,7 @@ def test_shared_items_federation(base_dir: str) -> None:
assert THR_BOB.is_alive() is False
os.chdir(base_dir)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False)
print('Testing federation of shared items between ' +
'Alice and Bob is complete')
@ -2354,7 +2354,7 @@ def test_group_follow(base_dir: str) -> None:
media_creator = 'Bumble'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False)
os.mkdir(base_dir + '/.tests')
# create the servers
@ -2758,7 +2758,7 @@ def test_group_follow(base_dir: str) -> None:
os.chdir(base_dir)
try:
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False)
except OSError:
print('Unable to remove directory ' + base_dir + '/.tests')
print('Testing following of a group is complete')
@ -2775,7 +2775,7 @@ def _test_followers_of_person(base_dir: str) -> None:
federation_list = []
base_dir = curr_dir + '/.tests_followersofperson'
if os.path.isdir(base_dir):
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
os.mkdir(base_dir)
os.chdir(base_dir)
create_person(base_dir, nickname, domain, port,
@ -2810,7 +2810,7 @@ def _test_followers_of_person(base_dir: str) -> None:
assert 'drokk@' + domain in follow_list
assert 'sausagedog@' + domain in follow_list
os.chdir(curr_dir)
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
def _test_followers_on_domain(base_dir: str) -> None:
@ -2825,7 +2825,7 @@ def _test_followers_on_domain(base_dir: str) -> None:
federation_list = []
base_dir = curr_dir + '/.tests_nooffollowersOndomain'
if os.path.isdir(base_dir):
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
os.mkdir(base_dir)
os.chdir(base_dir)
create_person(base_dir, nickname, domain, port, http_prefix, True,
@ -2877,7 +2877,7 @@ def _test_followers_on_domain(base_dir: str) -> None:
assert followers_on_other_domain == 2
os.chdir(curr_dir)
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
def _test_group_followers(base_dir: str) -> None:
@ -2892,7 +2892,7 @@ def _test_group_followers(base_dir: str) -> None:
federation_list = []
base_dir = curr_dir + '/.tests_testgroupfollowers'
if os.path.isdir(base_dir):
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
os.mkdir(base_dir)
os.chdir(base_dir)
create_person(base_dir, nickname, domain, port, http_prefix, True,
@ -2924,7 +2924,7 @@ def _test_group_followers(base_dir: str) -> None:
assert len(grouped['clutterly.domain']) == 1
os.chdir(curr_dir)
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
def _test_follows(base_dir: str) -> None:
@ -2938,7 +2938,7 @@ def _test_follows(base_dir: str) -> None:
federation_list = ['wild.com', 'mesh.com']
base_dir = curr_dir + '/.tests_testfollows'
if os.path.isdir(base_dir):
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
os.mkdir(base_dir)
os.chdir(base_dir)
create_person(base_dir, nickname, domain, port, http_prefix, True,
@ -3006,7 +3006,7 @@ def _test_follows(base_dir: str) -> None:
assert False
os.chdir(curr_dir)
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
def _test_create_person_account(base_dir: str):
@ -3022,7 +3022,7 @@ def _test_create_person_account(base_dir: str):
client_to_server = False
base_dir = curr_dir + '/.tests_createperson'
if os.path.isdir(base_dir):
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
os.mkdir(base_dir)
os.chdir(base_dir)
@ -3129,7 +3129,7 @@ def _test_create_person_account(base_dir: str):
assert 'Fediverse' in object_content
os.chdir(curr_dir)
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
def show_test_boxes(name: str, inbox_path: str, outbox_path: str) -> None:
@ -3152,7 +3152,7 @@ def _test_authentication(base_dir: str) -> None:
base_dir = curr_dir + '/.tests_authentication'
if os.path.isdir(base_dir):
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
os.mkdir(base_dir)
os.chdir(base_dir)
@ -3181,7 +3181,7 @@ def _test_authentication(base_dir: str) -> None:
auth_header, False)
os.chdir(curr_dir)
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir, ignore_errors=False)
def test_client_to_server(base_dir: str):
@ -3203,7 +3203,7 @@ def test_client_to_server(base_dir: str):
low_bandwidth = False
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False)
os.mkdir(base_dir + '/.tests')
# create the servers
@ -3727,8 +3727,8 @@ def test_client_to_server(base_dir: str):
assert THR_BOB.is_alive() is False
os.chdir(base_dir)
# shutil.rmtree(alice_dir, ignore_errors=False, onerror=None)
# shutil.rmtree(bob_dir, ignore_errors=False, onerror=None)
# shutil.rmtree(alice_dir, ignore_errors=False)
# shutil.rmtree(bob_dir, ignore_errors=False)
def _test_actor_parsing():
@ -3969,12 +3969,12 @@ def _test_addemoji(base_dir: str):
os.mkdir(path)
path = base_dir + '/.tests/emoji'
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
os.mkdir(path)
base_dir = path
path = base_dir + '/emoji'
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
os.mkdir(path)
copytree(base_dir_original + '/emoji', base_dir + '/emoji', False, None)
os.chdir(base_dir)
@ -4017,7 +4017,7 @@ def _test_addemoji(base_dir: str):
os.chdir(base_dir_original)
shutil.rmtree(base_dir_original + '/.tests',
ignore_errors=False, onerror=None)
ignore_errors=False)
def _test_get_status_number():
@ -6370,7 +6370,7 @@ def test_update_actor(base_dir: str):
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests',
ignore_errors=False, onerror=None)
ignore_errors=False)
os.mkdir(base_dir + '/.tests')
# create the server
@ -6475,7 +6475,7 @@ def test_update_actor(base_dir: str):
os.chdir(base_dir)
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
shutil.rmtree(base_dir + '/.tests', ignore_errors=False)
def _test_remove_interactions() -> None:
@ -7252,7 +7252,7 @@ def _test_httpsig_base_new(with_digest: bool, base_dir: str,
debug = True
path = base_dir + '/.testHttpsigBaseNew'
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
os.mkdir(path)
os.chdir(path)
@ -7366,7 +7366,7 @@ def _test_httpsig_base_new(with_digest: bool, base_dir: str,
message_body_json_str, False) is False
os.chdir(base_dir)
shutil.rmtree(path, ignore_errors=False, onerror=None)
shutil.rmtree(path, ignore_errors=False)
def _test_get_actor_from_in_reply_to() -> None:
@ -8368,7 +8368,7 @@ def _test_book_link(base_dir: str):
base_dir2 = base_dir + '/.testbookevents'
if os.path.isdir(base_dir2):
shutil.rmtree(base_dir2, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir2, ignore_errors=False)
os.mkdir(base_dir2)
content = 'Not a link'
@ -8687,7 +8687,7 @@ def _test_book_link(base_dir: str):
assert books_cache['readers'].get(actor)
if os.path.isdir(base_dir2):
shutil.rmtree(base_dir2, ignore_errors=False, onerror=None)
shutil.rmtree(base_dir2, ignore_errors=False)
def _test_uninvert2():