Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 tests are failing #53

Closed
milahu opened this issue Dec 9, 2021 · 14 comments
Closed

5 tests are failing #53

milahu opened this issue Dec 9, 2021 · 14 comments
Labels
bug Something isn't working

Comments

@milahu
Copy link

milahu commented Dec 9, 2021

blame dependencies versions?

Flask-2.0.2
werkzeug-2.0.1
Jinja2-3.0.2
lxml-4.6.3
commonmark-0.9.1
cryptography-3.4.8
======================================================================
FAIL: test_rewrite_svg (test.test_scrapbook_indexer.TestSingleHtmlConverter)
Test handling of embedded SVG
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_indexer.py", line 1726, in test_rewrite_svg
    self.assertEqual(rewritten, expected)
AssertionError: '<!DO[134 chars]tion/x-javascript,script.js"></script>\n  <scr[318 chars]y>\n' != '<!DO[134 chars]tion/javascript,script.js"></script>\n  <scrip[314 chars]y>\n'
  <!DOCTYPE html>
  <body>
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-   <script href="data:application/x-javascript,script.js"></script>
?                                  --
+   <script href="data:application/javascript,script.js"></script>
-   <script xlink:href="data:application/x-javascript,scriptx.js"></script>
?                                        --
+   <script xlink:href="data:application/javascript,scriptx.js"></script>
    <a href="data:image/bmp;base64,YS5ibXA=">
      <image href="data:image/bmp;base64,aW1hZ2UuYm1w" />
    </a>
    <a xlink:href="data:image/bmp;base64,YXguYm1w">
      <image xlink:href="data:image/bmp;base64,aW1hZ2V4LmJtcA==" />
    </a>
  </svg>
  </body>


======================================================================
FAIL: test_rewrite_svg_file (test.test_scrapbook_indexer.TestSingleHtmlConverter)
Test handling of SVG file
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_indexer.py", line 1778, in test_rewrite_svg_file
    self.assertEqual(rewritten, expected)
AssertionError: '<?xm[232 chars]tion/x-javascript,script.js"></script>\n  <scr[309 chars]g>\n' != '<?xm[232 chars]tion/javascript,script.js"></script>\n  <scrip[305 chars]g>\n'
  <?xml version="1.0"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-   <script href="data:application/x-javascript,script.js"></script>
?                                  --
+   <script href="data:application/javascript,script.js"></script>
-   <script xlink:href="data:application/x-javascript,scriptx.js"></script>
?                                        --
+   <script xlink:href="data:application/javascript,scriptx.js"></script>
    <a href="data:image/bmp;base64,YS5ibXA=">
      <image href="data:image/bmp;base64,aW1hZ2UuYm1w" />
    </a>
    <a xlink:href="data:image/bmp;base64,YXguYm1w">
      <image xlink:href="data:image/bmp;base64,aW1hZ2V4LmJtcA==" />
    </a>
  </svg>


======================================================================
FAIL: test_base (test.test_app_config.TestApp)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_app_config.py", line 200, in test_base
    self.assertIn('href="/scrap%20%E6%9B%B8/common.css?a=static"', html)
AssertionError: 'href="/scrap%20%E6%9B%B8/common.css?a=static"' not found in '<!DOCTYPE html>\n<html dir="ltr">\n<head>\n<meta charset="UTF-8">\n<meta name="viewport" content="width=device-width,initial-scale=1">\n<title>Index of /</title>\n<link rel="stylesheet" type="text/css" href="/common.css?a=static">\n<link rel="stylesheet" type="text/css" href="/index.css?a=static">\n<script src="/common.js?a=static"></script>\n<script src="/index.js?a=static"></script>\n<script src="/index-ex.js?a=static"></script>\n</head>\n<body>\n<header>\n<h1 id="header" class="breadcrumbs"><a>WebScrapBook</a>/</h1>\n</header>\n<main>\n<table id="data-table" data-sitename="WebScrapBook" data-base="" data-path="/">\n<thead>\n  <tr><th><a hidden>Directory</a></th><th><a>Name</a></th><th class="detail"><a>Last modified</a></th><th class="detail"><a>Size</a></th></tr>\n</thead>\n<tbody>\n  <tr class="file"><td data-sort="index.html"><a class="icon file" title="index.html"></a><td data-sort="index.html"><a href="index.html">index.html</a></td><td class="detail" data-sort="315619200.0">1980/01/02 00:00:00</td><td class="detail" data-sort="19">19 B</td></tr>\n  <tr class="dir"><td data-sort=".wsb"><a class="icon dir" title=".wsb"></a><td data-sort=".wsb"><a href=".wsb/">.wsb</a></td><td class="detail" data-sort="1639047188.0893135">2021/12/09 10:53:08</td><td class="detail" data-sort=""></td></tr>\n  <tr class="dir"><td data-sort="subdir"><a class="icon dir" title="subdir"></a><td data-sort="subdir"><a href="subdir/">subdir</a></td><td class="detail" data-sort="315619200.0">1980/01/02 00:00:00</td><td class="detail" data-sort=""></td></tr>\n  <tr class="file"><td data-sort="index.md"><a class="icon file" title="index.md"></a><td data-sort="index.md"><a href="index.md">index.md</a></td><td class="detail" data-sort="315619200.0">1980/01/02 00:00:00</td><td class="detail" data-sort="23">23 B</td></tr>\n</tbody>\n</table>\n</main>\n<footer>\n<form id="panel" autocomplete="off" hidden>\n  <select id="viewer">\n    <option value="" selected>Normal View</option>\n    <option value="gallery">Gallery View</option>\n    <option value="list">List View</option>\n    <option value="deep">Deep List</option>\n  </select>\n  <select id="command">\n    <option value="" selected>...</option>\n    <option value="source" hidden>View source</option>\n    <option value="download" hidden>Download</option>\n    <option value="exec" hidden>Run natively</option>\n    <option value="browse" hidden>Browse natively</option>\n    <option value="mkdir" hidden>New folder</option>\n    <option value="mkzip" hidden>New zip</option>\n    <option value="mkfile" hidden>New file</option>\n    <option value="edit" hidden>Edit</option>\n    <option value="editx" hidden>Edit page</option>\n    <option value="upload" hidden>Upload</option>\n    <option value="move" hidden>Move</option>\n    <option value="copy" hidden>Copy</option>\n    <option value="link" hidden>Create link</option>\n    <option value="delete" hidden>Delete</option>\n  </select>\n  <input type="file" id="upload-file-selector" multiple hidden>\n</form>\n</footer>\n</body>\n</html>'

======================================================================
FAIL: test_x_for (test.test_app_config.TestApp)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/lib/python3.9/unittest/mock.py", line 1337, in patched
    return func(*newargs, **newkeywargs)
  File "/build/source/test/test_app_config.py", line 425, in test_x_for
    self.assertFalse(data['data']['app']['is_local'])
AssertionError: True is not false

======================================================================
FAIL: test_data_annotations_other02 (test.test_scrapbook_convert_migrate.TestConvertDataFilesLegacy)
Don't error out if a legacy id is bad.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_convert_migrate.py", line 544, in test_data_annotations_other02
    self.assertEqual(output, expected)
AssertionError: '<!DO[163 chars]id="19700101000000123">finibus</span>\n<span d[152 chars]l>\n' != '<!DO[163 chars]id="123">finibus</span>\n<span data-scrapbook-[138 chars]l>\n'
  <!DOCTYPE html>
  <html>
  <head>
  <title data-scrapbook-elem="title">My page</title>
  </head>
  <body>
  <span data-scrapbook-id="">suscipit</span>
- <span data-scrapbook-id="19700101000000123">finibus</span>
?                           --------------
+ <span data-scrapbook-id="123">finibus</span>
  <span data-scrapbook-id="999999999999999999999999999999999999999999999999999999999">finibus</span>
  <span data-scrapbook-id="abc">varius</span>
  </body>
  </html>


----------------------------------------------------------------------
Ran 892 tests in 20.377s

FAILED (failures=5, skipped=10)
@danny0838 danny0838 added the bug Something isn't working label Dec 10, 2021
@danny0838
Copy link
Owner

Thank you for reporting. Unfortunately, some cases cannot be reproduced.

What is the version of your OS, Python, and PyWSB?

@milahu
Copy link
Author

milahu commented Dec 10, 2021

to reproduce, you can use my fork of nixpkgs at
https://github.com/milahu/nixpkgs/tree/webscrapbook-init-at-1.0.0

# install the nix package manager
# https://github.com/hardenedlinux/debian-nix-manager
sudo apt install nix-bin
sudo systemctl start nix-daemon
# now you should have a /nix folder in your filesystem

# install nix packages
git clone --depth 2 https://github.com/milahu/nixpkgs --branch webscrapbook-init-at-1.0.0
cd nixpkgs
git diff master # audit my patch versus nixpkgs master branch
sed -i 's/doCheck = false;/doCheck = true;/' pkgs/development/python-modules/webscrapbook/default.nix
cat >shell.nix <<'EOF'
{ pkgs ? (import ./. {}) }:
(pkgs.python39.withPackages (p: with p; [ webscrapbook ])).env
EOF
nix-shell

this will fetch (many) compiled packages from cache.nixos.org,
and try to build the webscrapbook package

i say "try to build" cos the build will fail in the checkPhase
this is why i have set doCheck = false; in the build file
pkgs/development/python-modules/webscrapbook/default.nix

@danny0838
Copy link
Owner

You did not answer the question. What is the Python and PyWSB version it uses?

It doesn't seem that a normal Python implementation will get your result, and we probably can not and would not support a special incompatible Python implementation.

@milahu
Copy link
Author

milahu commented Dec 10, 2021

nix-shell 
python --version
# Python 3.9.6

PyWSB master = 1.0.0 as declared in the build file

python 3.8.12 → 16 tests are failing

======================================================================
FAIL: test_rewrite_svg (test.test_scrapbook_indexer.TestSingleHtmlConverter)
Test handling of embedded SVG
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_indexer.py", line 1726, in test_rewrite_svg
    self.assertEqual(rewritten, expected)
AssertionError: '<!DO[134 chars]tion/x-javascript,script.js"></script>\n  <scr[318 chars]y>\n' != '<!DO[134 chars]tion/javascript,script.js"></script>\n  <scrip[314 chars]y>\n'
  <!DOCTYPE html>
  <body>
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-   <script href="data:application/x-javascript,script.js"></script>
?                                  --
+   <script href="data:application/javascript,script.js"></script>
-   <script xlink:href="data:application/x-javascript,scriptx.js"></script>
?                                        --
+   <script xlink:href="data:application/javascript,scriptx.js"></script>
    <a href="data:image/bmp;base64,YS5ibXA=">
      <image href="data:image/bmp;base64,aW1hZ2UuYm1w" />
    </a>
    <a xlink:href="data:image/bmp;base64,YXguYm1w">
      <image xlink:href="data:image/bmp;base64,aW1hZ2V4LmJtcA==" />
    </a>
  </svg>
  </body>


======================================================================
FAIL: test_rewrite_svg_file (test.test_scrapbook_indexer.TestSingleHtmlConverter)
Test handling of SVG file
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_indexer.py", line 1778, in test_rewrite_svg_file
    self.assertEqual(rewritten, expected)
AssertionError: '<?xm[232 chars]tion/x-javascript,script.js"></script>\n  <scr[309 chars]g>\n' != '<?xm[232 chars]tion/javascript,script.js"></script>\n  <scrip[305 chars]g>\n'
  <?xml version="1.0"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-   <script href="data:application/x-javascript,script.js"></script>
?                                  --
+   <script href="data:application/javascript,script.js"></script>
-   <script xlink:href="data:application/x-javascript,scriptx.js"></script>
?                                        --
+   <script xlink:href="data:application/javascript,scriptx.js"></script>
    <a href="data:image/bmp;base64,YS5ibXA=">
      <image href="data:image/bmp;base64,aW1hZ2UuYm1w" />
    </a>
    <a xlink:href="data:image/bmp;base64,YXguYm1w">
      <image xlink:href="data:image/bmp;base64,aW1hZ2V4LmJtcA==" />
    </a>
  </svg>


======================================================================
FAIL: test_base (test.test_app_config.TestApp)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_app_config.py", line 200, in test_base
    self.assertIn('href="/scrap%20%E6%9B%B8/common.css?a=static"', html)
AssertionError: 'href="/scrap%20%E6%9B%B8/common.css?a=static"' not found in '<!DOCTYPE html>\n<html dir="ltr">\n<head>\n<meta charset="UTF-8">\n<meta name="viewport" content="width=device-width,initial-scale=1">\n<title>Index of /</title>\n<link rel="stylesheet" type="text/css" href="/common.css?a=static">\n<link rel="stylesheet" type="text/css" href="/index.css?a=static">\n<script src="/common.js?a=static"></script>\n<script src="/index.js?a=static"></script>\n<script src="/index-ex.js?a=static"></script>\n</head>\n<body>\n<header>\n<h1 id="header" class="breadcrumbs"><a>WebScrapBook</a>/</h1>\n</header>\n<main>\n<table id="data-table" data-sitename="WebScrapBook" data-base="" data-path="/">\n<thead>\n  <tr><th><a hidden>Directory</a></th><th><a>Name</a></th><th class="detail"><a>Last modified</a></th><th class="detail"><a>Size</a></th></tr>\n</thead>\n<tbody>\n  <tr class="file"><td data-sort="index.html"><a class="icon file" title="index.html"></a><td data-sort="index.html"><a href="index.html">index.html</a></td><td class="detail" data-sort="315619200.0">1980/01/02 00:00:00</td><td class="detail" data-sort="19">19 B</td></tr>\n  <tr class="dir"><td data-sort=".wsb"><a class="icon dir" title=".wsb"></a><td data-sort=".wsb"><a href=".wsb/">.wsb</a></td><td class="detail" data-sort="1639133596.111512">2021/12/10 10:53:16</td><td class="detail" data-sort=""></td></tr>\n  <tr class="dir"><td data-sort="subdir"><a class="icon dir" title="subdir"></a><td data-sort="subdir"><a href="subdir/">subdir</a></td><td class="detail" data-sort="315619200.0">1980/01/02 00:00:00</td><td class="detail" data-sort=""></td></tr>\n  <tr class="file"><td data-sort="index.md"><a class="icon file" title="index.md"></a><td data-sort="index.md"><a href="index.md">index.md</a></td><td class="detail" data-sort="315619200.0">1980/01/02 00:00:00</td><td class="detail" data-sort="23">23 B</td></tr>\n</tbody>\n</table>\n</main>\n<footer>\n<form id="panel" autocomplete="off" hidden>\n  <select id="viewer">\n    <option value="" selected>Normal View</option>\n    <option value="gallery">Gallery View</option>\n    <option value="list">List View</option>\n    <option value="deep">Deep List</option>\n  </select>\n  <select id="command">\n    <option value="" selected>...</option>\n    <option value="source" hidden>View source</option>\n    <option value="download" hidden>Download</option>\n    <option value="exec" hidden>Run natively</option>\n    <option value="browse" hidden>Browse natively</option>\n    <option value="mkdir" hidden>New folder</option>\n    <option value="mkzip" hidden>New zip</option>\n    <option value="mkfile" hidden>New file</option>\n    <option value="edit" hidden>Edit</option>\n    <option value="editx" hidden>Edit page</option>\n    <option value="upload" hidden>Upload</option>\n    <option value="move" hidden>Move</option>\n    <option value="copy" hidden>Copy</option>\n    <option value="link" hidden>Create link</option>\n    <option value="delete" hidden>Delete</option>\n  </select>\n  <input type="file" id="upload-file-selector" multiple hidden>\n</form>\n</footer>\n</body>\n</html>'

======================================================================
FAIL: test_x_for (test.test_app_config.TestApp)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nix/store/dgmp76d54xxb3bka1fph17yz7n8rfkai-python3-3.8.12/lib/python3.8/unittest/mock.py", line 1325, in patched
    return func(*newargs, **newkeywargs)
  File "/build/source/test/test_app_config.py", line 425, in test_x_for
    self.assertFalse(data['data']['app']['is_local'])
AssertionError: True is not false

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/toggle.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/search.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/collapse.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/expand.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/external.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/item.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/fclose.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/fopen.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/file.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/note.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_update01 (test.test_scrapbook_cache.TestStaticSiteGenerator) (path='icon/postit.png')
Create nonexisting files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_cache.py", line 3044, in test_update01
    self.assertEqual(os.stat(file), orig_stats[file])
AssertionError: os.st[103 chars] st_atime=1639133606, st_mtime=1639133605, st_ctime=1639133605) != os.st[103 chars] st_atime=1639133605, st_mtime=1639133605, st_ctime=1639133605)

======================================================================
FAIL: test_data_annotations_other02 (test.test_scrapbook_convert_migrate.TestConvertDataFilesLegacy)
Don't error out if a legacy id is bad.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/source/test/test_scrapbook_convert_migrate.py", line 544, in test_data_annotations_other02
    self.assertEqual(output, expected)
AssertionError: '<!DO[163 chars]id="19700101000000123">finibus</span>\n<span d[152 chars]l>\n' != '<!DO[163 chars]id="123">finibus</span>\n<span data-scrapbook-[138 chars]l>\n'
  <!DOCTYPE html>
  <html>
  <head>
  <title data-scrapbook-elem="title">My page</title>
  </head>
  <body>
  <span data-scrapbook-id="">suscipit</span>
- <span data-scrapbook-id="19700101000000123">finibus</span>
?                           --------------
+ <span data-scrapbook-id="123">finibus</span>
  <span data-scrapbook-id="999999999999999999999999999999999999999999999999999999999">finibus</span>
  <span data-scrapbook-id="abc">varius</span>
  </body>
  </html>


----------------------------------------------------------------------
Ran 892 tests in 21.588s

FAILED (failures=16, skipped=10)

@danny0838
Copy link
Owner

Please check the following code and report the result in that environment:

import mimetypes
mimetypes.guess_type('test.js')

@milahu
Copy link
Author

milahu commented Dec 10, 2021

$ python
Python 3.9.6 (default, Jun 28 2021, 08:57:49)
>>> import mimetypes
>>> mimetypes.guess_type('test.js')
('application/x-javascript', None)
$ python
Python 3.8.12 (default, Aug 30 2021, 16:42:10) 
>>> import mimetypes
>>> mimetypes.guess_type('test.js')
('application/x-javascript', None)

@danny0838
Copy link
Owner

danny0838 commented Dec 10, 2021

That's bizarre. A normal python implementation should return ('application/javascript', None). There's probably something wrong with your environment.

@milahu
Copy link
Author

milahu commented Dec 10, 2021

@milahu
Copy link
Author

milahu commented Dec 10, 2021

i would call this a bug in python ...

/lib/python3.8/mimetypes.py reads mimetypes from /etc/mime.types

https://github.com/python/cpython/blob/main/Lib/mimetypes.py#L381

# /nix/store/dgmp76d54xxb3bka1fph17yz7n8rfkai-python3-3.8.12/lib/python3.8/mimetypes.py

def init(files=None):

    if files is None or _db is None:
        db = MimeTypes()

    for file in files:
        if os.path.isfile(file):
            db.read(file) # /etc/mime.types

    types_map = db.types_map[True]

and later returns

types_map[True]['.js'] # -> application/x-javascript
cat /nix/store/6kgfmzx90c1a6afqnbkz6qprkzss476k-mime-types-9/etc/mime.types | grep javascript
application/javascript										js
application/x-javascript									js

the last entry application/x-javascript overwrites the previous entry application/javascript
but apparently, /etc/mime.types is sorted from preferred first to deprecated last

/etc/mime.types is provided by mime-types
source: https://mirrors.kernel.org/gentoo/distfiles/mime-types-9.tar.bz2

@milahu
Copy link
Author

milahu commented Dec 10, 2021

apparently, /etc/mime.types is sorted from preferred first to deprecated last

nope, its sorted by alphabet

cat mime.types | LC_ALL=C sort >mime.types.2
diff mime.types mime.types.2 && echo same
# -> same

@milahu
Copy link
Author

milahu commented Dec 10, 2021

i would call this a bug in python ...

https://bugs.python.org/issue46035

milahu/cpython@8a50633

@danny0838
Copy link
Owner

I would consider it a feature rather than a bug. We would force canonical MIME for .js instead.

danny0838 added a commit that referenced this issue Dec 10, 2021
- .astimezone() for a datetime object with a pre-epoch time raises an error on Windows. (see: https://bugs.python.org/issue36759)
- Remove affected test as we don't expect a pre-epoch timestamp.
danny0838 added a commit that referenced this issue Dec 10, 2021
- atime is modified after running checksum. Check mtime and size instead.
danny0838 added a commit that referenced this issue Dec 10, 2021
Current implementation of app.base is not compatible with werkzeug 2.*. Remove this feature as it's rather ad hoc.
@danny0838
Copy link
Owner

1.1.0 should have fixed all issues.

@milahu
Copy link
Author

milahu commented Dec 10, 2021

yepp : )

all tests are passing on python 3.8 and python 3.9

closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants