test: Update --tmpdir doc string to say directory must not exist #29498

pull kevkevinpal wants to merge 1 commits into bitcoin:master from kevkevinpal:tmpDirDocString changing 1 files +1 −1
  1. kevkevinpal commented at 12:47 AM on February 28, 2024: contributor

    The error message given if passing an existing dir to --tmpdir is confusing so this makes it clear that the directory must not already exist

    This change is motivated by this comment #29335 (comment)

  2. test: Update --tmpdir doc string to say directory must not exist
    The error message given if passing an existing dir to --tmpdir is
    confusing so this makes it clear that the directory must not already
    exist
    d4e36ae80d
  3. DrahtBot commented at 12:47 AM on February 28, 2024: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, davidgumberg

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label Tests on Feb 28, 2024
  5. Empact commented at 7:05 AM on February 28, 2024: contributor

    Might you be able to modify the message as well? It will be the most available info when people encounter it.

  6. maflcko commented at 8:42 AM on February 28, 2024: member

    lgtm ACK d4e36ae80d4b3f03647fd9057461edf7ecd794a3

  7. kevkevinpal commented at 11:10 PM on March 12, 2024: contributor

    Updated in be027e0 I added a line to enable logging and it now gives this error which it did not before because it would throw an error because logging was not enabled

    New Error message

    ./test/functional/feature_bind_port_discover.py --tmpdir=./temp
    2024-03-12T23:08:06.633000Z TestFramework (ERROR): Unexpected exception caught during testing
    Traceback (most recent call last):
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 130, in main
        self.setup()
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 267, in setup
        os.makedirs(self.options.tmpdir, exist_ok=False)
      File "<frozen os>", line 225, in makedirs
    FileExistsError: [Errno 17] File exists: '/Users/kevkevin/DEVDIR/bitcoin/temp'
    Traceback (most recent call last):
      File "/Users/kevkevin/DEVDIR/bitcoin/./test/functional/feature_bind_port_discover.py", line 78, in <module>
        BindPortDiscoverTest().main()
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 154, in main
        exit_code = self.shutdown()
                    ^^^^^^^^^^^^^^^
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 310, in shutdown
        self.network_thread.close()
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'close'
    

    Previous Error message

    Traceback (most recent call last):
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 130, in main
        self.setup()
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 266, in setup
        os.makedirs(self.options.tmpdir, exist_ok=False)
      File "<frozen os>", line 225, in makedirs
    FileExistsError: [Errno 17] File exists: '/Users/kevkevin/DEVDIR/bitcoin/temp'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 148, in main
        self.log.exception("Unexpected exception caught during testing")
        ^^^^^^^^
    AttributeError: 'BindPortDiscoverTest' object has no attribute 'log'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/kevkevin/DEVDIR/bitcoin/./test/functional/feature_bind_port_discover.py", line 78, in <module>
        BindPortDiscoverTest().main()
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 154, in main
        exit_code = self.shutdown()
                    ^^^^^^^^^^^^^^^
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 304, in shutdown
        if self.success == TestStatus.FAILED and self.options.pdbonfailure:
           ^^^^^^^^^^^^
    AttributeError: 'BindPortDiscoverTest' object has no attribute 'success'
    
  8. kevkevinpal commented at 11:10 PM on March 12, 2024: contributor

    I may want to find a way to remove the logs after FileExistsError: [Errno 17] File exists: '/Users/kevkevin/DEVDIR/bitcoin/temp' to make this error more clear

  9. kevkevinpal commented at 11:14 PM on March 12, 2024: contributor

    force pushed once more eb28434

    the error log now makes sense

    ./test/functional/feature_bind_port_discover.py --tmpdir=./temp
    2024-03-12T23:12:18.583000Z TestFramework (ERROR): Unexpected exception caught during testing
    Traceback (most recent call last):
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 130, in main
        self.setup()
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 267, in setup
        os.makedirs(self.options.tmpdir, exist_ok=False)
      File "<frozen os>", line 225, in makedirs
    FileExistsError: [Errno 17] File exists: '/Users/kevkevin/DEVDIR/bitcoin/temp'
    2024-03-12T23:12:18.584000Z TestFramework (INFO): Stopping nodes
    2024-03-12T23:12:18.584000Z TestFramework (WARNING): Not cleaning up dir /Users/kevkevin/DEVDIR/bitcoin/temp
    2024-03-12T23:12:18.584000Z TestFramework (ERROR): Test failed. Test logging available at /Users/kevkevin/DEVDIR/bitcoin/temp/test_framework.log
    2024-03-12T23:12:18.584000Z TestFramework (ERROR):
    2024-03-12T23:12:18.584000Z TestFramework (ERROR): Hint: Call /Users/kevkevin/DEVDIR/bitcoin/test/functional/combine_logs.py '/Users/kevkevin/DEVDIR/bitcoin/temp' to consolidate all logs
    2024-03-12T23:12:18.584000Z TestFramework (ERROR):
    2024-03-12T23:12:18.584000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    2024-03-12T23:12:18.585000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
    2024-03-12T23:12:18.585000Z TestFramework (ERROR):
    
  10. kevkevinpal force-pushed on Mar 13, 2024
  11. kevkevinpal force-pushed on Mar 13, 2024
  12. DrahtBot added the label CI failed on Mar 13, 2024
  13. kevkevinpal force-pushed on Mar 13, 2024
  14. kevkevinpal force-pushed on Mar 13, 2024
  15. kevkevinpal force-pushed on Mar 13, 2024
  16. kevkevinpal force-pushed on Mar 13, 2024
  17. kevkevinpal force-pushed on Mar 13, 2024
  18. kevkevinpal commented at 1:50 AM on March 13, 2024: contributor

    new error log in c5eb4688a90577c573861cc56f10c9dac15f97de

    let me know if you want to change the verbiage and if the dir exists we use the default location and then raise and exception

    ./test/functional/p2p_tx_privacy.py --tmpdir=./tmp
    2024-03-13T01:48:26.199000Z TestFramework (ERROR): The tmpdir must not already exist ./tmp
    2024-03-13T01:48:26.200000Z TestFramework (ERROR): Unexpected exception caught during testing
    Traceback (most recent call last):
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 130, in main
        self.setup()
      File "/Users/kevkevin/DEVDIR/bitcoin/test/functional/test_framework/test_framework.py", line 268, in setup
        os.makedirs(self.options.tmpdir, exist_ok=False)
      File "<frozen os>", line 225, in makedirs
    FileExistsError: [Errno 17] File exists: '/Users/kevkevin/DEVDIR/bitcoin/tmp'
    2024-03-13T01:48:26.201000Z TestFramework (INFO): Stopping nodes
    2024-03-13T01:48:26.201000Z TestFramework (WARNING): Not cleaning up dir /var/folders/9g/cvx014yx4dq5lwl_x5zvn_j80000gn/T/bitcoin_func_test_9s71cl9w
    2024-03-13T01:48:26.201000Z TestFramework (ERROR): Test failed. Test logging available at /var/folders/9g/cvx014yx4dq5lwl_x5zvn_j80000gn/T/bitcoin_func_test_9s71cl9w/test_framework.log
    2024-03-13T01:48:26.201000Z TestFramework (ERROR):
    2024-03-13T01:48:26.201000Z TestFramework (ERROR): Hint: Call /Users/kevkevin/DEVDIR/bitcoin/test/functional/combine_logs.py '/var/folders/9g/cvx014yx4dq5lwl_x5zvn_j80000gn/T/bitcoin_func_test_9s71cl9w' to consolidate all logs
    2024-03-13T01:48:26.201000Z TestFramework (ERROR):
    2024-03-13T01:48:26.201000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    2024-03-13T01:48:26.201000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
    2024-03-13T01:48:26.202000Z TestFramework (ERROR):
    
  19. kevkevinpal force-pushed on Mar 13, 2024
  20. kevkevinpal force-pushed on Mar 13, 2024
  21. in test/functional/test_framework/test_framework.py:272 in 09067cc39d outdated
     269 | +                self.options.tmpdir = os.path.abspath(tmpdirpath)
     270 | +                os.makedirs(self.options.tmpdir, exist_ok=False)
     271 | +            except Exception:
     272 | +                self.options.tmpdir = tempfile.mkdtemp(prefix=TMPDIR_PREFIX)
     273 | +                self._start_logging()
     274 | +                self.log.error("The tmpdir must not already exist {}".format(tmpdirpath))
    


    maflcko commented at 8:07 AM on March 13, 2024:

    Not sure about using a different tempdir than the one the user asked for as fallback to start logging.

    I don't think code needs to be written for users that fail to read the docs, and also fail to read the python stacktrace?


    kevkevinpal commented at 2:43 PM on March 13, 2024:
  22. DrahtBot removed the label CI failed on Mar 13, 2024
  23. kevkevinpal force-pushed on Mar 13, 2024
  24. maflcko commented at 3:26 PM on March 13, 2024: member

    rfm?

  25. bitcoin deleted a comment on Apr 9, 2024
  26. maflcko assigned fanquake on Apr 9, 2024
  27. fanquake merged this on Apr 9, 2024
  28. fanquake closed this on Apr 9, 2024

  29. Pttn referenced this in commit 8b19f5b733 on Apr 13, 2024
  30. PastaPastaPasta referenced this in commit 2c2f215457 on Oct 25, 2024
  31. PastaPastaPasta referenced this in commit 1a8e805aab on Oct 26, 2024
  32. PastaPastaPasta referenced this in commit f211bb9289 on Oct 27, 2024
  33. bitcoin locked this on Apr 9, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me