Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# This file is part of Hypothesis, which may be found at 

2# https://github.com/HypothesisWorks/hypothesis/ 

3# 

4# Most of this work is copyright (C) 2013-2020 David R. MacIver 

5# (david@drmaciver.com), but it contains contributions by others. See 

6# CONTRIBUTING.rst for a full list of people who may hold copyright, and 

7# consult the git log if you need to determine who owns an individual 

8# contribution. 

9# 

10# This Source Code Form is subject to the terms of the Mozilla Public License, 

11# v. 2.0. If a copy of the MPL was not distributed with this file, You can 

12# obtain one at https://mozilla.org/MPL/2.0/. 

13# 

14# END HEADER 

15 

16import os 

17 

18__hypothesis_home_directory_default = os.path.join(os.getcwd(), ".hypothesis") 

19 

20__hypothesis_home_directory = None 

21 

22 

23def set_hypothesis_home_dir(directory): 

24 global __hypothesis_home_directory 

25 __hypothesis_home_directory = directory 

26 

27 

28def mkdir_p(path): 

29 try: 

30 os.makedirs(path) 

31 except OSError: 

32 pass 

33 

34 

35def storage_directory(*names): 

36 global __hypothesis_home_directory 

37 if not __hypothesis_home_directory: 

38 __hypothesis_home_directory = os.getenv("HYPOTHESIS_STORAGE_DIRECTORY") 

39 if not __hypothesis_home_directory: 

40 __hypothesis_home_directory = __hypothesis_home_directory_default 

41 return os.path.join(__hypothesis_home_directory, *names)