New paste Repaste Download
self = <test_sector_momentum_filter.TestLoadSymbolMomentumData object at 0x120a2b380>
tmp_path = PosixPath('/private/var/folders/nd/10vlhn017bggc5tz6d7dph100000gn/T/pytest-of-cao/pytest-404/popen-gw0/test_load_symbol_momentum_from0')
    def test_load_symbol_momentum_from_json_file(self, tmp_path):
        """Test loading momentum data from JSON files."""
        from datetime import date
        from unittest.mock import patch
    
        from rtrader.cli.trader_eod_core.services.log_formatting_service import (
            load_symbol_momentum_data,
        )
    
        # Create test JSON file with momentum data
        test_date = date(2025, 8, 18)
        json_file = tmp_path / f"AAPL-{test_date.isoformat()}.json"
        json_file.write_text(json.dumps({
            "symbol": "AAPL",
            "rows": [{"momentum": {"final_score": 0.15}}]
        }))
    
        # Mock NFS_STORAGE_BASE_PATH to prevent NFS hang on .exists()
>       with patch(
            "rtrader.cli.trader_eod_core.services.log_formatting_service.settings.NFS_STORAGE_BASE_PATH",
            "/tmp/nonexistent_nfs",
        ):
tests/cli/test_sector_momentum_filter.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../.pyenv/versions/3.12.12/lib/python3.12/unittest/mock.py:1467: in __enter__
    original, local = self.get_original()
                      ^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <unittest.mock._patch object at 0x1234e3890>
    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <MagicMock id='4861943088'> does not have the attribute 'NFS_STORAGE_BASE_PATH'
../.pyenv/versions/3.12.12/lib/python3.12/unittest/mock.py:1437: AttributeError
Filename: None. Size: 2kb. View raw, , hex, or download this file.

This paste expires on 2026-07-25 18:13:58.772729+00:00. Pasted through deprecated-web.