Skip to content

Commit

Permalink
Fix 'tox -e lint' tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adroullier committed Oct 24, 2023
1 parent cbdc4b9 commit 74d675c
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/pyramid/scripts/prequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def run(self):
config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if not '__script__' in config_vars:
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
path = self.args.path_info

Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/scripts/proutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def run(self, quiet=False):
config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if not '__script__' in config_vars:
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
loader = self.get_config_loader(config_uri)
loader.setup_logging(config_vars)
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/scripts/pserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def run(self): # pragma: no cover
config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if not '__script__' in config_vars:
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
app_spec = self.args.config_uri
app_name = self.args.app_name
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/scripts/pshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def run(self, shell=None):
config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if not '__script__' in config_vars:
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
loader = self.get_config_loader(config_uri)
loader.setup_logging(config_vars)
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/scripts/ptweens.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def run(self):
config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if not '__script__' in config_vars:
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
self.setup_logging(config_uri, global_conf=config_vars)
env = self.bootstrap(config_uri, options=config_vars)
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/scripts/pviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def run(self):
config_uri = self.args.config_uri
config_vars = parse_vars(self.args.config_vars)
# bw update 2.1 don't overwrite if set
if not '__script__' in config_vars:
if '__script__' not in config_vars:
config_vars['__script__'] = self.script_name
url = self.args.url

Expand Down
5 changes: 4 additions & 1 deletion tests/test_scripts/test_prequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,10 @@ def test_command_method_configures_logging(self):
def test_command_script_name(self):
command = self._makeOne(['', '--method=GET', 'development.ini', '/'],)
command.run()
self.assertEqual(self.loader.calls[0]['defaults']['__script__'], 'prequest')
self.assertEqual(
self.loader.calls[0]['defaults']['__script__'],
'prequest'
)


class Test_main(unittest.TestCase):
Expand Down
5 changes: 4 additions & 1 deletion tests/test_scripts/test_pserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def get_app(name, global_conf):
self.loader.server = lambda x: x

inst.run()
self.assertEqual(app.global_conf, {'a': '1', 'b': '2', '__script__': 'pserve'})
self.assertEqual(
app.global_conf,
{'a': '1', 'b': '2', '__script__': 'pserve'}
)

def test_original_ignore_files(self):
msg = 'A change to "ignore_files" was detected'
Expand Down

0 comments on commit 74d675c

Please sign in to comment.