File tree Expand file tree Collapse file tree 3 files changed +13
-24
lines changed
Expand file tree Collapse file tree 3 files changed +13
-24
lines changed Original file line number Diff line number Diff line change @@ -124,11 +124,11 @@ Or you can use ``iex`` as a function decorator to launch ipdb if an exception is
124124Using a non-default ipython-profile
125125-----------------------------------
126126By default ``ipdb `` will instantiate an ipython-session loaded with the default profile called ``default ``.
127- You can set a non-default profile by setting the environment variable ``IPDB_IPYTON_PROFILE ``:
127+ You can set a non-default profile by setting the environment variable ``IPDB_IPYTHON_PROFILE ``:
128128
129129.. code-block :: bash
130130
131- export IPDB_IPYTON_PROFILE =" ipdb"
131+ export IPDB_IPYTHON_PROFILE =" ipdb"
132132
133133 Or by setting in ``pyproject.toml ``:
134134
@@ -137,7 +137,7 @@ Or by setting in ``pyproject.toml``:
137137 [tool.ipdb]
138138 ipython_profile = "ipdb"
139139
140- This should correspond with a profile-directory ``profile_ipdb``` in your ``IPYTHON_HOME ``.
140+ This should correspond with a profile-directory ``profile_ipdb `` in your ``IPYTHON_HOME ``.
141141If this profile-directory does not exist, we fall back to the default profile.
142142
143143
Original file line number Diff line number Diff line change @@ -62,14 +62,19 @@ def _get_debugger_cls(ipython_profile="default"):
6262 return shell .debugger_cls
6363
6464
65- def _init_pdb (context = None , ipython_profile = None , commands = []):
65+ def _init_pdb (context = None , ipython_profile = None , commands = None ):
66+ if commands is None :
67+ commands = []
68+
6669 if context is None :
67- context = os .getenv ("IPDB_CONTEXT_SIZE" , get_context_from_config ())
70+ context = os .getenv ("IPDB_CONTEXT_SIZE" , None )
71+ if context is None :
72+ context = get_context_from_config ()
6873
6974 if ipython_profile is None :
70- ipython_profile = os .getenv (
71- "IPDB_IPYTHON_PROFILE" , get_ipython_profile_from_config ()
72- )
75+ ipython_profile = os .getenv ("IPDB_IPYTHON_PROFILE" , None )
76+ if ipython_profile is None :
77+ ipython_profile = get_ipython_profile_from_config ( )
7378
7479 debugger_cls = _get_debugger_cls (ipython_profile = ipython_profile )
7580
Original file line number Diff line number Diff line change @@ -138,22 +138,6 @@ def test_noenv_nodef_nosetup_pyproject(self):
138138 self .assertEqual (self .pyproject_context , cfg .getint ("ipdb" , "context" ))
139139 self .assertRaises (configparser .NoOptionError , cfg .get , "ipdb" , "version" )
140140
141- def test_noenv_nodef_nosetup_pyproject (self ):
142- """
143- Setup: $IPDB_CONFIG unset, $HOME/.ipdb does not exist,
144- setup.cfg does not exist, pyproject.toml exists
145- Result: load pyproject.toml
146- """
147- os .unlink (self .env_filename )
148- os .unlink (self .default_filename )
149- os .remove (self .setup_filename )
150- with ModifiedEnvironment (IPDB_CONFIG = None , HOME = self .tmpd ):
151- cfg = get_config ()
152- # breakpoint()
153- self .assertEqual (["ipdb" ], cfg .sections ())
154- self .assertEqual (self .pyproject_context , cfg .getint ("ipdb" , "context" ))
155- self .assertRaises (configparser .NoOptionError , cfg .get , "ipdb" , "version" )
156-
157141 def test_env_nodef_setup_pyproject (self ):
158142 """
159143 Setup: $IPDB_CONFIG is set, $HOME/.ipdb does not exist,
You can’t perform that action at this time.
0 commit comments