Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

can't create directory in python mac os x

Posted on 2015-02-21
1
Medium Priority
?
80 Views
Last Modified: 2015-03-12
I'm trying to set up a test , but this does not seem to create a directory ('m new to python)
import unittest
import glob
import os

PATH = "extentest"

class FileHandling(unittest.TestCase):

	def setUp(self):
		self.path = PATH
		self.file_names = ["file.ext123", "file.ext123", "file.ext123",
			"file.ext123", "file.ext123", "file.ext223","file.ext223"]
		os.mkdir(self.path)
		for fn in self.file_names:
			f = open(self.path+fn, "w")
			f.close()
	
if __name__ == "__main__":
    unittest.main()

Open in new window

0
Comment
Question by:sniger
1 Comment
 
LVL 25

Accepted Solution

by:
clockwatcher earned 2000 total points
ID: 40624480
The setUp method is run before each test and your class doesn't have any tests.  Without a test, I can't imagine it would be run.  Try adding a test.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A set of related code is known to be a Module, it helps us to organize our code logically which is much easier for us to understand and use it. Module is an object with arbitrarily named attributes which can be used in binding and referencing. …
Sequence is something that used to store data in it in very simple words. Let us just create a list first. To create a list first of all we need to give a name to our list which I have taken as “COURSE” followed by equals sign and finally enclosed …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question