vmihailenco: Add a test
diff --git a/pybrake/notifier.py b/pybrake/notifier.py
index 9218c51..c673108 100644
--- a/pybrake/notifier.py
+++ b/pybrake/notifier.py
@@ -295,7 +295,7 @@ class Notifier:
             needed = "/site-packages/"
             ind = s.find(needed)
             if ind > -1:
-                s = "[SITE_PACKAGES]/" + s[ind + len(needed) :]
+                s = "/SITE_PACKAGES/" + s[ind + len(needed) :]
                 return s
 
         s = s.replace(self._context["rootDirectory"], "/PROJECT_ROOT")

[SITE_PACKAGES] -> /SITE_PACKAGES
https://github.com/airbrake/pybrake/blob/master/pybrake/notifier.py#L298
diff --git a/pybrake/test_notifier.py b/pybrake/test_notifier.py
index e7bc2d9..8774ef8 100644
--- a/pybrake/test_notifier.py
+++ b/pybrake/test_notifier.py
@@ -205,3 +205,9 @@ def _test_rate_limited():
 
     notice = future.result()
     assert notice["error"] == "IP is rate limited"
+
+def test_clean_filename():
+    notifier = Notifier()
+
+    filename = notifier._clean_filename("home/lib/python3.6/site-packages/python.py")
+    assert filename == "/SITE_PACKAGES/python.py"

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest>=4.3.0 pytest-benchmark>=3.2.2 pylint django flask aiohttp pytest
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
accumulation-tree==0.6.2
aiohttp==3.8.6
aiosignal==1.2.0
asgiref==3.4.1
astroid==2.11.7
async-timeout==4.0.2
asynctest==0.13.0
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==3.0.1
click==8.0.4
dataclasses==0.8
dill==0.3.4
Django==3.2.25
Flask==2.0.3
frozenlist==1.2.0
idna==3.10
idna-ssl==1.1.0
importlib-metadata==4.8.3
iniconfig==1.1.1
isort==5.10.1
itsdangerous==2.0.1
Jinja2==3.0.3
lazy-object-proxy==1.7.1
MarkupSafe==2.0.1
mccabe==0.7.0
multidict==5.2.0
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
py-cpuinfo==9.0.0
-e git+https://github.com/airbrake/pybrake.git@6970c56dfd3cf8caba339321f020ebc04d8129b0#egg=pybrake
pylint==2.13.9
pyparsing==3.1.4
pytest==7.0.1
pytest-benchmark==3.4.1
pytz==2025.2
pyudorandom==1.0.0
sqlparse==0.4.4
tdigest==0.5.2.2
tomli==1.2.3
typed-ast==1.5.5
typing_extensions==4.1.1
Werkzeug==2.0.3
wrapt==1.16.0
yarl==1.7.2
zipp==3.6.0

name: pybrake
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - accumulation-tree==0.6.2
      - aiohttp==3.8.6
      - aiosignal==1.2.0
      - asgiref==3.4.1
      - astroid==2.11.7
      - async-timeout==4.0.2
      - asynctest==0.13.0
      - attrs==22.2.0
      - charset-normalizer==3.0.1
      - click==8.0.4
      - dataclasses==0.8
      - dill==0.3.4
      - django==3.2.25
      - flask==2.0.3
      - frozenlist==1.2.0
      - idna==3.10
      - idna-ssl==1.1.0
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - isort==5.10.1
      - itsdangerous==2.0.1
      - jinja2==3.0.3
      - lazy-object-proxy==1.7.1
      - markupsafe==2.0.1
      - mccabe==0.7.0
      - multidict==5.2.0
      - packaging==21.3
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - py==1.11.0
      - py-cpuinfo==9.0.0
      - pylint==2.13.9
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-benchmark==3.4.1
      - pytz==2025.2
      - pyudorandom==1.0.0
      - sqlparse==0.4.4
      - tdigest==0.5.2.2
      - tomli==1.2.3
      - typed-ast==1.5.5
      - typing-extensions==4.1.1
      - werkzeug==2.0.3
      - wrapt==1.16.0
      - yarl==1.7.2
      - zipp==3.6.0
prefix: /opt/conda/envs/pybrake

pybrake/test_notifier.py::test_clean_filename
pybrake/test_notifier.py::test_build_notice_from_exception pybrake/test_notifier.py::test_build_notice_from_str pybrake/test_notifier.py::test_unauthorized
pybrake/test_notifier.py::test_build_notice_from_none pybrake/test_notifier.py::test_environment pybrake/test_notifier.py::test_root_directory pybrake/test_notifier.py::test_filter_data pybrake/test_notifier.py::test_filter_ignore pybrake/test_notifier.py::test_filter_ignore_async pybrake/test_notifier.py::test_unknown_host pybrake/test_notifier.py::test_truncation pybrake/test_notifier.py::test_revision_override pybrake/test_notifier.py::test_revision_from_git pybrake/test_notifier.py::test_keys_blacklist_exact pybrake/test_notifier.py::test_keys_blacklist_regexp
pybrake/notifier.py
pybrake/notifier.py