How to use mkdirs method in localstack

Best Python code snippet using localstack_python

unit-nsinstall.py

Source: unit-nsinstall.py Github

copy

Full Screen

...33 dir = self.tmpdir34 f = os.path.join(dir, file)35 open(f, 'w').close()36 return f37 def mkdirs(self, dir):38 d = os.path.join(self.tmpdir, dir)39 os.makedirs(d)40 return d41 def test_nsinstall_D(self):42 "Test nsinstall -D <dir>"43 testdir = os.path.join(self.tmpdir, "test")44 self.assertEqual(nsinstall(["-D", testdir]), 0)45 self.assert_(os.path.isdir(testdir))46 def test_nsinstall_basic(self):47 "Test nsinstall <file> <dir>"48 testfile = self.touch("testfile")49 testdir = self.mkdirs("testdir")50 self.assertEqual(nsinstall([testfile, testdir]), 0)51 self.assert_(os.path.isfile(os.path.join(testdir, "testfile")))52 def test_nsinstall_basic_recursive(self):53 "Test nsinstall <dir> <dest dir>"54 sourcedir = self.mkdirs("sourcedir")55 self.touch("testfile", sourcedir)56 Xfile = self.touch("Xfile", sourcedir)57 copieddir = self.mkdirs("sourcedir/​copieddir")58 self.touch("testfile2", copieddir)59 Xdir = self.mkdirs("sourcedir/​Xdir")60 self.touch("testfile3", Xdir)61 destdir = self.mkdirs("destdir")62 self.assertEqual(nsinstall([sourcedir, destdir,63 '-X', Xfile,64 '-X', Xdir]), 0)65 testdir = os.path.join(destdir, "sourcedir")66 self.assert_(os.path.isdir(testdir))67 self.assert_(os.path.isfile(os.path.join(testdir, "testfile")))68 self.assert_(not os.path.exists(os.path.join(testdir, "Xfile")))69 self.assert_(os.path.isdir(os.path.join(testdir, "copieddir")))70 self.assert_(os.path.isfile(os.path.join(testdir, "copieddir", "testfile2")))71 self.assert_(not os.path.exists(os.path.join(testdir, "Xdir")))72 def test_nsinstall_multiple(self):73 "Test nsinstall <three files> <dest dir>"74 testfiles = [self.touch("testfile1"),75 self.touch("testfile2"),76 self.touch("testfile3")]77 testdir = self.mkdirs("testdir")78 self.assertEqual(nsinstall(testfiles + [testdir]), 0)79 for f in testfiles:80 self.assert_(os.path.isfile(os.path.join(testdir,81 os.path.basename(f))))82 def test_nsinstall_dir_exists(self):83 "Test nsinstall <dir> <dest dir>, where <dest dir>/​<dir> already exists"84 srcdir = self.mkdirs("test")85 destdir = self.mkdirs("testdir/​test")86 self.assertEqual(nsinstall([srcdir, os.path.dirname(destdir)]), 0)87 self.assert_(os.path.isdir(destdir))88 def test_nsinstall_t(self):89 "Test that nsinstall -t works (preserve timestamp)"90 testfile = self.touch("testfile")91 testdir = self.mkdirs("testdir")92 # set mtime to now - 30 seconds93 t = int(time.time()) - 3094 os.utime(testfile, (t, t))95 self.assertEqual(nsinstall(["-t", testfile, testdir]), 0)96 destfile = os.path.join(testdir, "testfile")97 self.assert_(os.path.isfile(destfile))98 self.assertEqual(os.stat(testfile).st_mtime,99 os.stat(destfile).st_mtime)100 if sys.platform != "win32":101 # can't run this test on windows, don't have real file modes there102 def test_nsinstall_m(self):103 "Test that nsinstall -m works (set mode)"104 testfile = self.touch("testfile")105 mode = 0600106 os.chmod(testfile, mode)107 testdir = self.mkdirs("testdir")108 self.assertEqual(nsinstall(["-m", "{0:04o}"109 .format(mode), testfile, testdir]), 0)110 destfile = os.path.join(testdir, "testfile")111 self.assert_(os.path.isfile(destfile))112 self.assertEqual(os.stat(testfile).st_mode,113 os.stat(destfile).st_mode)114 def test_nsinstall_d(self):115 "Test that nsinstall -d works (create directories in target)"116 # -d makes no sense to me, but ok!117 testfile = self.touch("testfile")118 testdir = self.mkdirs("testdir")119 destdir = os.path.join(testdir, "subdir")120 self.assertEqual(nsinstall(["-d", testfile, destdir]), 0)121 self.assert_(os.path.isdir(os.path.join(destdir, "testfile")))122 if RUN_NON_ASCII_TESTS:123 def test_nsinstall_non_ascii(self):124 "Test that nsinstall handles non-ASCII files"125 filename = u"\u2325\u3452\u2415\u5081"126 testfile = self.touch(filename)127 testdir = self.mkdirs(u"\u4241\u1D04\u1414")128 self.assertEqual(nsinstall([testfile.encode("utf-8"),129 testdir.encode("utf-8")]), 0)130 destfile = os.path.join(testdir, filename)131 self.assert_(os.path.isfile(destfile))132 def test_nsinstall_non_ascii_subprocess(self):133 "Test that nsinstall as a subprocess handles non-ASCII files"134 filename = u"\u2325\u3452\u2415\u5081"135 testfile = self.touch(filename)136 testdir = self.mkdirs(u"\u4241\u1D04\u1414")137 # We don't use subprocess because it can't handle Unicode on138 # Windows <http:/​/​bugs.python.org/​issue1759845>. mozprocess calls139 # CreateProcessW directly so it's perfect.140 p = processhandler.ProcessHandlerMixin([sys.executable,141 NSINSTALL_PATH,142 testfile, testdir])143 p.run()144 rv = p.waitForFinish()145 self.assertEqual(rv, 0)146 destfile = os.path.join(testdir, filename)147 self.assert_(os.path.isfile(destfile))148 #TODO: implement -R, -l, -L and test them!149if __name__ == '__main__':150 mozunit.main()

Full Screen

Full Screen

environ.py

Source: environ.py Github

copy

Full Screen

...17 def under_m14_dir(cls, *paths, mkdirs=False):18 base_dir = os.environ.get('JOKER_HOME') or under_home_dir('.m14')19 if not mkdirs:20 return abs_path_join(base_dir, *paths)21 return abs_path_join_and_mkdirs(base_dir, *paths)22 @classmethod23 def under_m14_subdir(cls, *paths, mkdirs=False):24 _paths = cls.namespaces[1:]25 _paths.extend(paths)26 return cls.under_m14_dir(*_paths, mkdirs=mkdirs)27 @classmethod28 def _get_conf_path_names(cls):29 names = cls.namespaces.copy()30 names.append(cls._get_option('confpath_filename'))...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

13 Best Java Testing Frameworks For 2023

The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.

QA Innovation &#8211; Using the senseshaping concept to discover customer needs

QA Innovation - Using the senseshaping concept to discover customer needsQA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.

Best 23 Web Design Trends To Follow In 2023

Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.

Acquiring Employee Support for Change Management Implementation

Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful