peek-python 25.0.26__tar.gz → 25.0.27__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: peek-python
3
- Version: 25.0.26
3
+ Version: 25.0.27
4
4
  Summary: peek - like print, but easy
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/salabim/peek
@@ -34,7 +34,7 @@ import pprint
34
34
  import builtins
35
35
  import shutil
36
36
 
37
- __version__ = "25.0.26"
37
+ __version__ = "25.0.27"
38
38
 
39
39
  from pathlib import Path
40
40
 
@@ -473,7 +473,7 @@ class _Peek:
473
473
  if filename not in _Peek.codes:
474
474
  frame_info = inspect.getframeinfo(call_frame, context=1000000) # get the full source code
475
475
  if frame_info.code_context is None:
476
- _Peek.code[filename] = ""
476
+ _Peek.codes[filename] = ""
477
477
  else:
478
478
  _Peek.codes[filename] = frame_info.code_context
479
479
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: peek-python
3
- Version: 25.0.26
3
+ Version: 25.0.27
4
4
  Summary: peek - like print, but easy
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/salabim/peek
@@ -10,7 +10,7 @@ authors = [
10
10
  { name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com" },
11
11
  ]
12
12
  description = "peek - like print, but easy"
13
- version = "25.0.26"
13
+ version = "25.0.27"
14
14
  readme = "README.md"
15
15
  requires-python = ">=3.9"
16
16
  dependencies = [
@@ -10,10 +10,9 @@ import shutil
10
10
  from pathlib import Path
11
11
 
12
12
 
13
- file_folder = Path(__file__).parent
14
- top_folder = (file_folder / ".." / "peek").resolve()
15
- sys.path.insert(0, str(top_folder))
16
- os.chdir(file_folder)
13
+ import os, sys # three lines to use the local package and chdir
14
+ os.chdir(os.path.dirname(__file__))
15
+ sys.path.insert(0, os.path.dirname(__file__) + "/../" + os.path.dirname(__file__).split(os.sep)[-2])
17
16
 
18
17
  import peek
19
18
 
@@ -37,11 +36,6 @@ cyan=peek.ANSI.cyan
37
36
  white=peek.ANSI.white
38
37
  reset=peek.ANSI.reset
39
38
 
40
- class g:
41
- pass
42
-
43
-
44
- context_start = "#"
45
39
 
46
40
  Pythonista = sys.platform == "ios"
47
41
 
@@ -67,7 +61,7 @@ def test_time(patch_datetime_now):
67
61
  def test_no_arguments(capsys):
68
62
  result = peek()
69
63
  out, err = capsys.readouterr()
70
- assert out.startswith(context_start)
64
+ assert out.startswith("#")
71
65
  assert out.endswith(" in test_no_arguments()\n")
72
66
  assert result is None
73
67
 
@@ -107,7 +101,7 @@ def test_in_function(capsys):
107
101
 
108
102
  hello("world")
109
103
  out, err = capsys.readouterr()
110
- assert out.startswith(context_start)
104
+ assert out.startswith("#")
111
105
  assert out.endswith(" in test_in_function.hello() ==> val='world'\n")
112
106
 
113
107
 
@@ -117,7 +111,7 @@ def test_in_function_no_parent(capsys):
117
111
 
118
112
  hello("world")
119
113
  out, err = capsys.readouterr()
120
- assert out.startswith(context_start)
114
+ assert out.startswith("#")
121
115
  assert not out.endswith(" in test_in_function_no_parent.hello() ==> val='world'\n")
122
116
 
123
117
 
@@ -142,11 +136,12 @@ def test_time_delta():
142
136
 
143
137
 
144
138
  def test_dynamic_prefix(capsys):
145
- g.i = 0
139
+ i = 0
146
140
 
147
141
  def prefix():
148
- g.i += 1
149
- return str(g.i) + ")"
142
+ nonlocal i
143
+ i += 1
144
+ return str(i) + ")"
150
145
 
151
146
  hello = "world"
152
147
  peek(hello, prefix=prefix)
@@ -209,10 +204,11 @@ def test_repr_and_str(capsys):
209
204
 
210
205
 
211
206
  def test_output(capsys, tmpdir):
212
- g.result = ""
207
+ result = ""
213
208
 
214
209
  def my_output(s):
215
- g.result += s
210
+ nonlocal result
211
+ result += s
216
212
 
217
213
  hello = "world"
218
214
  peek(hello, output=print)
@@ -271,7 +267,7 @@ def test_output(capsys, tmpdir):
271
267
  out, err = capsys.readouterr()
272
268
  assert out == ""
273
269
  assert out == ""
274
- assert g.result == "hello='world'\n1\n"
270
+ assert result == "hello='world'\n1\n"
275
271
 
276
272
  def test_serialize(capsys):
277
273
  def serialize(s):
@@ -320,6 +316,7 @@ def test_as_str():
320
316
  assert s == "hello='world'\n"
321
317
 
322
318
 
319
+ @pytest.mark.skipif(Pythonista, reason="Pythonista problem")
323
320
  def test_colored_end(capsys):
324
321
  hello = "world"
325
322
  s = peek(hello, color="red", end="|", as_str=True)
@@ -1212,6 +1209,7 @@ hello='world'
1212
1209
  )
1213
1210
 
1214
1211
 
1212
+ @pytest.mark.skipif(Pythonista, reason="Pythonista problem")
1215
1213
  def test_stop():
1216
1214
  with pytest.raises(SystemExit):
1217
1215
  peek.stop()
File without changes
File without changes