Created
March 21, 2011 18:40
-
-
Save TalhaAkkas/879950 to your computer and use it in GitHub Desktop.
Klasörün içindeki tüm dosyaları test eden program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: cp1254 -*- | |
import os | |
import doctest | |
def tani(klasor): | |
Cikti = [] | |
for i in range(len(klasor)): | |
islendi = False | |
j = len(klasor[i]) | |
while j > 0: | |
j -= 1 | |
if klasor[i][j] == ".": | |
islendi = True | |
try: | |
if (klasor[i][j+1]+klasor[i][j+2] == "py") and (len(klasor[i]) == j+3): | |
Cikti.append(1) | |
break | |
else: | |
Cikti.append(0) | |
break | |
except : | |
Cikti.append(0) | |
break | |
if not islendi: | |
Cikti.append(2) | |
return Cikti | |
def gir(adres): | |
klasor = os.listdir(adres) | |
liste = tani(klasor) | |
for i in range(len(klasor)): | |
if liste[i] == 2: | |
gir(adres + "\\" + klasor[i]) | |
elif liste[i] == 1: | |
doctest.testfile(adres + "\\" + klasor[i]) | |
def main(): | |
anaklasor = raw_input("Lütfe doctest yapılacak klasorun tam adresini girin") | |
gir(anaklasor) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment